开发者

CURL Issue. PHP script not running on call

I'm looking for any help debugging what could be preventing my php code from running when I CURL the page containing the script.

I am making this call from one PHP script:

$ch = curl_init(开发者_运维百科$this->curl_address . $querystring);
$response = curl_exec($ch);
curl_close($ch);

To this script: (the script actually does stuff, but it wasn't running, so I broke it down to this so that I would have evidence that it does not run, this is what is currently there, and there is no output in the log)

error_log("got here");

On my test server (a Mac), the CURL'd script runs (I get output in the log), but on my production server it fails. In both cases one script on the server is calling another.

The production server is a Linux VPS running (I believe) CentOS.

I don't know what issues I should be looking for on the production server. Any help is appreciated.

Thanks.


In your script hosted in the server, use a function_exists('curl_init'); to check whether cURL is installed or not. This function will return a boolean true if the function exists, false otherwise.

If it returns false, you have to install cURL in the server.

You can also use a phpinfo(); call, if you want detailed information about your PHP setup.


I meant to update this question over the weekend when I finally figured out the problem. The production server was serving over HTTPS, while the test server was not. The issue I was having was because the server wasn't authenticating over cURL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜