cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

CURL_EXEC TIMEOUT in Webserver not CLI

From: Paul Chan <wayofdragon_at_gmail.com>
Date: Thu, 22 Jun 2006 00:44:24 -0400

Hi All,

I have a PHP script which uses curl to post a request to a remote site.
However, it only works when I run the script with command line php, but not
with the apache webserver. Everytime I get to curl_exec(), I get a timeout
#28 error when I run it with apache. I checked to make sure that curl is
actually installed and compiled into php by running phpinfo(). Here is the
result that I got:

 CURL support enabled CURL Information libcurl/7.12.1 OpenSSL/0.9.7a
zlib/1.2.1.2 libidn/0.5.6
When I run "php -i" in CLI, I also have the same result.

I really don't understand what this the difference? Both seem to be using
the same php.ini. Is there a setting in php.ini which will cause this
behavior? Anything in apache config which will cause this behavior?

Here is the fragment of the script that I run:

/* Use CURL to execute XML POST and write output into a string */
        $ch = curl_init( $this->myGatewayURL );
        curl_setopt( $ch, CURLOPT_POST, 1 );
        curl_setopt( $ch, CURLOPT_POSTFIELDS, $xmlRequest );
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
        curl_setopt( $ch, CURLOPT_TIMEOUT, 240 );
        curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
        curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
        $xmlResponse = curl_exec( $ch );

Please, if someone can help me with this problem I would greatly appreciate
it.

Thanks!

Paul

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2006-06-22