0

I have been trying to enable curl on PHP 7.1.4 which is running off of Apache HTTPD 2.4. The steps I have taken so far are:

Uncomment extension=php_curl.dll
Ensure that the ext path is set correctly (I have tested this by enabling openssl which works)
Adding the PHP root folder to my PATH environment variable
Fully stopped the server and started again

Although the function var_dump(extension_loaded('curl')); is false and curl is not listed under phpinfo();

I have run PHP --ri curl and it states: cURL support => enabled cURL Information => 7.53.1

I have also run deplister on the curl dll and it states that all lines are ok.

Please could you advise me of any other debugging steps or silly mistakes that I could have made (I feel that I have spent too many hours looking at this problem and a fresh set of eyes...)

More system info: Compiler MSVC14 (Visual C++ 2015)
Architecture x64
Windows 7 platform

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
user2502611
  • 11
  • 1
  • 1

3 Answers3

1

The PHP you run via the command line and the PHP Apache uses, are two separate things. Your CLI version of PHP has the CURL extension and your mod_php / php-fpm version does not have it.

You need to install the extension to your mod_php / php-fpm version.

Find where the PHP INI file for Apache PHP is, and edit to include the CURL module.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • Thanks for the answer. What additional steps to the ones above (uncommenting the initial line ect.) Do I need to take to enable the extension? As these steps worked for other extensions such as openssl – user2502611 Apr 20 '17 at 06:25
  • You need to find where the PHP INI file for the Apache PHP is, and edit it. You need also to make sure that the version has the module available. – Tero Kilkanen Apr 20 '17 at 09:41
  • I have enabled it in the ini file and the php_curl.dll is in the ext folder and the author of curl is listed in phpinfo();. Does this mean that curl has the module available? – user2502611 Apr 20 '17 at 12:34
  • If `phpinfo()` shows the module, then it is loaded. – Tero Kilkanen Apr 20 '17 at 14:07
  • the module is only showed under the author category, which i do not think means it is enabled. It does not have it's own section like the other models​that are enabled do. – user2502611 Apr 20 '17 at 16:41
1

This saved my life (from https://www.php.net/manual/en/curl.installation.php)

Upgrading to php 7.1.6 on Apache 2.4 32bit version Windows 7 x64

this curl implementation works:

  1. C:/(path to php folder)/php.ini enable extension=php_curl.dll

libeay32.dll, ssleay32.dll, libssh2.dll find directly in php7 folder

  1. add this to Apache/conf/httpd.conf

    load curl and open ssl libraries LoadFile "C:/(path to php folder)/libeay32.dll" LoadFile "C:/(path to php folder)/ssleay32.dll"

LoadFile "C:/(path to php folder)/libssh2.dll"

If you don't find some of these DLLs, try downloaidng a non-TS version of php and copy them from that folder.

Handsome Nerd
  • 107
  • 10
0

Running as Standalone HTTPd i have this line on my Batch-Script.

SET PATH=%SystemRoot%;%SystemRoot%\System32;%~dp0php72;%~dp0Apache24\bin

It resolve my issue with Apache24 x64 with PHP 7.2

Abbas
  • 137
  • 3