6

I have Apache 2.4.12 and php 5.6.9 on my Windows 8 computer and I'm trying to enable the curl extension for php however, I haven't had much success. After searching the internet for this issue it appears that other's have had the same trouble. Here are the suggestions I've found:

  • Uncomment ;extension=php_curl.dll in php.ini
  • Uncomment ;extension_dir = "ext" in php.ini
  • Download and replace the php_curl.dll file in the ext directory of php with one from this website
  • Add to the PATH environment variable where php is installed
  • Copy libeay32.dll and ssleay32.dll from where php is installed to C:\Windows\System32

I've tried every single suggestion with no success except the third item in the list because it doesn't have a .dll file for curl with php 5.6, in fact the highest version avaible is one for php 5.4. There has to be way to enable this extension without having to downgrade my php version to 5.4 and using a .dll file from that website. I've tried searching the internet for a .dll file like the one on the linked website for php 5.6 opposed to a version of php that's outdated but I've had no luck in finding one so I'd like help with this issue.

How can I enable curl for php 5.6 on my Windows 8 machine?

6
  • 1
    What did you use to enable curl on windows? May 30, 2015 at 5:53
  • Did you try to copy the php_curl.dll from a ready-to-use WAMP (like Xampp, Wamp, etc) using the same version of your PHP (i.e. in C:\htdocs\php\ext\php_curl.dll for Xampp) ? FIY, extension_dir = "ext" is the directory within which you have all your PHP extensions. May 30, 2015 at 6:12
  • @MatthieuBoisjoli I'm not quite sure what you mean. I don't have php intalled as a service so I've been pressing CTR-C and starting Apache up again by typing httpd.exe in the terminal. I've been testing if it's working by calling the curl_init(); function to see if there's any errors.
    – CasualKyle
    May 30, 2015 at 16:27
  • @IvanGabriele I downloaded and installed the most recent version of Xampp which is for php 5.6.8 and replaced the php_curl.dll in the ext directory of my php installation but that doesn't work either. Could it be that I'm using php 5.6.9 but the .dll file from Xampp is for php 5.6.8?
    – CasualKyle
    May 30, 2015 at 16:32
  • Yes, normally you have to respect the exact version. But did you actually try the official PHP installation for extensions on Windows : php.net/manual/en/install.windows.extensions.php ? May 30, 2015 at 16:52

5 Answers 5

10

Locate your php folder and follow these instructions:

  1. Move to Windows\system32 folder:

    libssh2.dll, php_curl.dll, ssleay32.dll, libeay32.dll

  2. Move to Apache24\bin folder

libssh2.dll

  1. Uncomment extension=php_curl.dll

Note: Don't overwrite when prompted.

Source

2
  • 5
    For me I just had to copy libssh2.dll to Apache24\bin folder and it worked.
    – caiosm1005
    Jul 11, 2016 at 4:07
  • Thank you! Copying libssh2.dll to Apache folder worked also for me on Wampserver 2.4 and PHP 5.6.25. Aug 22, 2016 at 19:33
3

I give you an example of a set up that just worked perfectly for me :

  1. downloaded the VC11 x86 Thread Safe version of PHP,
  2. unzipped it within a directory C:\php,
  3. edited the php.ini-development, uncommenting 2 lines :
    • extension=php_curl.dll
    • extension_dir = "ext"
  4. saved this file under php.ini.

I just tested it via the CLI (windows CMD here) on a PHP a file (i.e. C:\php\php myFile.php) and cURL worked.

If you have Apache installed and prefer to test it in a browser, you obviously have to adapt this installation with your own files structure and to do not forget to restart Apache.

2

Running apache service with a specific user other than local system solved the problem for me. You can test this easily by stopping the apache service and running manually <apache dir>\bin\httpd.exe.

1
  • Actually this is caused by having set your %PATH% variable on your user instead of on the system profile. By moving them in the system path, it will solve this issue. Jun 2, 2017 at 1:36
0

I fixed this problem by adding C:\php and C:\php\ext to PATH system variables.

  1. Press window + pause to bring up the System Properties page.
  2. Click Advanced System Settings
  3. Click Environment Variables

You'll see the Path variable in the System Variables box in the bottom. Append your PHP path to that variable. Now the system will be able to load the extensions.

0

In addition to uncommenting the line

;extension_dir = "ext"

Try also setting it to the absolute path of the PHP installation's ext folder and then restarting apache.

e.g.:

extension_dir = "C:\PHP 5.6.19\ext"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.