Shawn
Shawn

Reputation: 717

Cannot get cURL to load in PHP on Windows Apache

I am not familiar at all with setting up an Apache/PHP web server, but I have to do this since my IT staff won't. I've looked at everything I can find online, and I just can't get cURL to load in PHP on windows apache. I installed Apache 2.2, it works. I installed PHP, and that works, which I know because my php script checks to ensure the cURL extension is loaded, and my php echo is returned to the browser, my code for that is shown below:

  if (!extension_loaded("curl")) {
     header('Status: 500', true, 500);
     echo 'cURL extension for PHP is not loaded! <br/> Add the following lines to your php.ini file: <br/> extension_dir = &quot;&lt;your-php-install-location&gt;/ext&quot; <br/> extension = php_curl.dll';
     return;
  }

I've done the following:

Nothing has worked. I'm running on a Windows Server 2003 box. I get no error message in the Apache log. I'm stuck. Please help! Thanks.

Adding requested Apache log info:

[Tue Aug 14 14:38:22 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Aug 14 14:38:23 2012] [notice] Apache/2.2.22 (Win32) PHP/5.2.17 mod_ssl/2.2.22 OpenSSL/0.9.8t configured -- resuming normal operations
[Tue Aug 14 14:38:23 2012] [notice] Server built: Jan 28 2012 11:16:39
[Tue Aug 14 14:38:23 2012] [notice] Parent: Created child process 5616
[Tue Aug 14 14:38:24 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Aug 14 14:38:25 2012] [notice] Child 5616: Child process is running
[Tue Aug 14 14:38:25 2012] [notice] Child 5616: Acquired the start mutex.
[Tue Aug 14 14:38:25 2012] [notice] Child 5616: Starting 64 worker threads.
[Tue Aug 14 14:38:25 2012] [notice] Child 5616: Starting thread to listen on port 8080.

Upvotes: 1

Views: 6686

Answers (2)

Gavin
Gavin

Reputation: 7976

For Windows 7 64bit I had to copy php_curl.dll, libeay32.dll and ssleay32.dll into \Windows\SysWOW64.

Upvotes: 1

MMReza
MMReza

Reputation: 115

If you install PHP, Apache in Windows operating system then following step can help you to run php_curl.dll smoothly.

  1. Find the location of php.ini (probably in C:\Windows) file and open it. Then uncomment (remove semi-colon(;) from ;extension=php_curl.dll) the line and save the file.
  2. Make sure that php_curl.dll is exist in your PHP extension directory (C:\php\ext). This extension path define in your php.ini file.
  3. Copy php4ts.dll (if you use PHP4) or php5ts.dll (if you use PHP5), libeay32.dll and ssleay32.dll to the C:\WINNT (Windows 2000) or C:\Windows (Windows 2003) directory. If php4ts.dll or php5ts.dll not found in your computer then search in google and download. Other two dll can found in the dlls directory of your PHP directory (may be in C:\php\ext)
  4. Restart Apache service.

Check again that cURL is enable. If not then restart your computer.
Now run script again and see your php_curl is now working smoothly.
If not then, copy above 3 dll file (describe in no.3) to your PHP root directory (may be C:\php) and also in Windows system32 directory (C:\Windows\system32).

Now run smoothly your php cURL script. Have a nice day.

Upvotes: 5

Related Questions