0

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.

1
  • 1
    do you have curl installed on your server? Commented Oct 11, 2011 at 3:15

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi Mario, Ok, I've run function_exists('curl_init'), and I get true returned. I checked out phpinfo, and the curl details are pretty slim in comparison to my test server. It only lists two lines: cURL support enabled cURL Information libcurl/7.21.4 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 The cURL response still returns false, and the error is not logged. Any thoughts?
Most likely that cURL is failing itself then. Try doing a var_dump(curl_init()); and post its results. If the result is something like “Resource #x” then cURL should be working fine and the issue is somewhere else.
0

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.

1 Comment

So you unpicked my answer because you found something unrelated to the answer? I gave the correct answer to what you asked and now you changed it. Downvoting your question then.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.