How to get CURL to work with PHP on Windows? (WAMP)

Viewed 59598

Update: The problem appears to have been corrupt DLLs somewhere in my PHP installation, or possibly a bug in PHP 5.2.9 on Win2k. I downloaded the windows (binaries-only) distribution of PHP 5.2.10 from php.net and extracted that to my c:\PHP directory. After doing that, everything worked fine.

Update2: I undid everything that I tried earlier (everything from the bulleted list below), except that I left "extension=php_curl.dll" uncommented in my php.ini file. It turns out that is all you should have to do in a proper installation.


I'm trying to get CURL to work on a Windows installation of PHP (version 5.2.9-2), and I am at wit's end. I have found the PHP CURL installation page, this SO question which references this page, and this SO question. I've tried most of the suggestions in all of those pages but I still get an error. Here is my very simple test page:

<?php
$ch = curl_init();
?>
<b>Success!</b>

This gives me:

Fatal error: Call to undefined function curl_init() in C:\ApacheRoot\curltest.php on line 2

In my Apache error log I get this each time the server starts:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\PHP\\ext\\php_curl.dll' - The specified procedure could not be found.\r\n in Unknown on line 0

I have done the following:

  • Uncommented the following line in php.ini: extension=php_curl.dll
  • Copied ssleay32.dll and libeay32.dll from C:\PHP to C:\WINNT\System32
  • Downloaded cURL for Win32 from curl.haxx.se and extracted the .zip file to C:\cURL
  • Added C:\cURL to my system PATH environment variable.
  • Verified that:
    • php.ini includes extension_dir="C:\PHP\ext"
    • The directory C:\PHP\ext contains php_curl.dll
    • The only php.ini file on my system is in C:\PHP (i.e. especially that there is no C:\WINNT\php.ini)
    • The Apache httpd.conf file includes the line PHPIniDir "C:/PHP/"

I have also rebooted the machine (several times, in fact...).

7 Answers
Related