简体   繁体   中英

Enabling CURL with PHP 5.6 on Windows 8

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?

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

  3. Uncomment extension=php_curl.dll

Note: Don't overwrite when prompted.

Source

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 (ie 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.

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 .

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.

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.

eg:

extension_dir = "C:\PHP 5.6.19\ext"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM