I am seeing a very bizarre problem with a PHP application I am building.
I have 2 virtual hosts on my development server (windows 7 64-bit) sometestsite.com
and endpoint.sometestsite.com
.
In my hosts
file, I configured sometestsite.com
and endpoint.sometestsite.com
to point to 127.0.0.1
.
Everything works when the server was running Apache 2.4.2 with PHP 5.4.9 as a fcgi module.
I then removed Apache and installed nginx-1.2.5 (windows build). I got php-cgi.exe running as a service and everything seems to work fine.
The problem is that a CURL call from sometestsite.com
to endpoint.sometestsite.com
that previously worked would time out.
I then moved that piece of code by itself to a small PHP file for testing:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://endpoint.sometestsite.com/test');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('provider' => urlencode('provider'),
'key' => urlencode('asdf')));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Execute and get the data back
$result = curl_exec($ch);
var_dump($result);
This is what I receive in the PHP logs:
PHP Fatal error: Maximum execution time of 30 seconds exceeded in D:\www\test5.php on line 22
PHP Stack trace:
PHP 1. {main}() D:\www\test5.php:0
However, if I run the same request using CLI CURL (via Git Bash), it works fine:
$ curl -X POST 'http://endpoint.sometestsite.com/test' -d'provider=provider&key=asdf'
{"test": "OK"}
This is quite strange as the PHP is exactly the same version and has the same configuration as when Apache was used.
I am not sure if this is a web server configuration issue or a problem with PHP's CURL yet.
Can anyone provide some insight/past experiences as to why this is happening?