PHP cURL timeout not working

I have a problem with the server. I am running a local server (for development), and I changed my local server from MAMP to XAMPP. However, in XAMPP, the cURL option CURLOPT_TIMEOUT_MSeither CURLOPT_CONNECTTIMEOUT_MSgives me the following error:

Warning: curl_setopt () expects parameter 2 to be long, the string is set

Is it because of the version of PHP or cURL? Maybe a configuration setting?

curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT_MS, 2500);

Additional Information:

  • OSX 10.6.8
  • PHP 5.3.1
  • cURL 7.19.7

Thanks in advance.


Edit: There seems to be some confusion regarding the error and the variable to set. An error indicates that parameter 2 is invalid. Not parameter 3 . So the problem CURLOPT_CONNECTTIMEOUT_MS.

curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT_MS, 2500);
            ^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^
parameter:     #1                 #2               #3

: var_dump(CURLOPT_CONNECTTIMEOUT_MS); string(25) "CURLOPT_CONNECTTIMEOUT_MS". , float.

+5
2

- CURLOPT_CONNECTTIMEOUT_MS PHP. PHP, , , .

156: :

curl_setopt($this->ch, /*CURLOPT_CONNECTTIMEOUT_MS */ 156, 2500);

, , , .

+7

, . script. , .

if (! defined (CURLOPT_CONNECTTIMEOUT_MS)) define ('CURLOPT_CONNECTTIMEOUT_MS', 156);

+8

All Articles