|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-12-08 13:25 UTC] procyonar at gmail dot com
Description: ------------ This is possibly the same problem as described in http://bugs.php.net/bug.php?id=50406 . PHP 5.2.11, vanilla distribution from php.net, without any relevant php.ini changes, slows dows to a crawl on Windows 7 Ultimate whenever php_curl.dll extension is enabled. It happens both in cli and in apache2 versions. Just running "php -v" (version output) takes about 5-6 seconds when curl is enabled (and a CPU usage spike). With curl disabled, it is near instantaneous, as expected. I haven't tested whether curl actually works. A similar delay occurs on .php page load, etc. WRT bug 50406, I believe curl initialization code, however complicated it might be, is not supposed to take 5 seconds all by itself. I verified that in PHP 5.3.0 on Windows XP and PHP 5.2.11 on Gentoo Linux, just to be certain, and in both cases there was no delay. Reproduce code: --------------- php -v Expected result: ---------------- <1 s execution time Actual result: -------------- 5-6 s execution time. A similar delay occurs whenever ANY PHP script, cli or apache2, is ran. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 04:00:02 2025 UTC |
Confirmed as still a problem in 5.2.13 I copied my php.ini file from c:\php\php.ini to \php\523\php.ini and updated the extension_dir directory inside the file to point to the new \php\523\ext folder. I verified this change worked by running: php -c . -v This prints: PHP 5.2.13 (cli) (built: Feb 24 2010 14:32:32) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies And a delay of 5 seconds. If I rename the 523\ext\php_curl.dll and re-run the command, I get an error about a missing module as expected (verified this ext dir is being used etc). If I uncomment php_curl.dll under extensions in php.ini, the same command completes immediately. On my system at least, disabling the php_curl extension fixes the problem. Interestingly, I do not have any page load delay using curl on web pages (uisng php 5.2.11). I am using IIS with Windows 7. The example code from the php documentation page works as expected: <?php $ch = curl_init("http://www.example.com/"); $fp = fopen("example_homepage.txt", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); --- (I see an example_homepage.txt file with the html contents inside). phpinfo() also reports the CURL extension has loaded. Commenting out the php_curl extension in the ini file and restarting IIS (to refresh the php ini file) shows the expected 'Fatal error: Call to undefined function curl_init()' error. So to summarise: 1) The latest PHP version still appears to have this problem 2) The md5sum of php_curl.dll between these php versions has changed; however the included libeay32.dll file has remained the same 3) It's interesting that CURL (and even just loading a blank PHP page) runs without delay under IIS, but using the CLI causes a problem. 4) mailnew2ster at mail dot ru's comment about libeay32.dll being patched is interesting. Perhaps this is the fault of OpenSSL under Windows? Maybe libeay32.dll needs to be updated to a newer version in the PHP distribution? I found another version of this file on my computer, but using that in place of the one PHP comes with causes an 'Ordinal not found' error during PHP startup when it tries to load the curl extension. I suspect PHP/php_curl needs to be compiled/linked to the newer DLL for it to work, so I cannot test a newer libeay32.dll build on my own. It may be worth a shot finding a newer version of this library (from OpenSSL?) and compiling/linking the php_curl module against it and then testing if the extension still causes the delay with an updated libeay32.dll.Thanks, will check Here is my last way to fix it (if openssl is already enabled in php) PHP 5.3.6 VC9 x86 module without SSL Library Init ------------------------------------------------- tanguy.pruvot@gmail.com - 06 May 2011 The curl module slow down PHP init on Windows since PHP 5.2 The docs might be a bit sparse in this ares, yes. But the SSL bit should be set unless you have initialized the OpenSSL library already in some other way. And in fact the openssl module already do library init, so if loaded, this patch should not impact security PHP_MINIT_FUNCTION(openssl) ... SSL_library_init(); It is possible to fix that in extension code, in interface.c : by replacing CURL_GLOBAL_SSL by CURL_GLOBAL_WIN32... if (curl_global_init(CURL_GLOBAL_WIN32) != CURLE_OK) { return FAILURE; } Related discussion : http://http://bugs.php.net/bug.php?id=53578 http://tanguy.tk/?q=content/php-535-correctif-lenteur-au-chargement-de-phpcurl (french) http://osdir.com/ml/web.curl.general/2004-05/msg00068.html http://curl.haxx.se/mail/lib-2004-06/0133.html