Apache 2.4, PHP 7.4.7, Windows 10 can't load cURL Extension from Apache Service but loads fine from Command Line with httpd

Viewed 1277

I have been fighting this problem for 2 days now and can't seem to solve it. I installed Apache on my computer and am running as localhost. I do not have SSL but have tried with and without loading openssl extension. If I start the Apache 24 Service from "Windows Services" PHP works but no extension dlls will be loaded, specifically I'm trying to load cURL. If I stop the "Windows Services" and run httpd from a command prompt all of the extensions load just fine.

Interestingly enough all PHP functionality works fine except the extensions when running from the "Windows Services".

The event log shows the following when I first start the "Apache Windows Service":

php[29280] 
PHP Warning: PHP Startup: Unable to load dynamic library 'php_curl' (tried: ext\php_curl (The specified module could not be found.), ext\php_php_curl.dll (The specified module could not be found.)) (D:\Apache24\bin\httpd.exe -d D:/Apache24) 

The only real clue I have found in the phpinfo is the difference I see between the "Windows Service" and the Command Line httpd is:

"Windows Service"

enter image description here

"Command Line httpd"

enter image description here

My php.ini file has the following settings for cURL:

extension_dir = "ext"
extension=curl
extension=openssl

PHP Info Screen Shots:

Common to Both

enter image description here

Using command line "httpd"

enter image description here

Using Windows Service (Note cURL is missing and event log shows the error mentioned above)

enter image description here

I also noticed the "Configuration File (php.ini) Path" is set to "C:\Windows" so I tried copying the php.ini file to c:\windows and copied the ext folder containing all of the dlls to C:\Windows as well but still had the exact same problem. I have since removed the php.ini and ext folder from C:\Windows to avoid any future path problems.

Does anyone have any idea what I'm missing?

1 Answers

Define the path of the extention directory to full path from

extension_dir = "ext"

to

extension_dir = "c:\PHP7.4.7\ext"
Related