PHP for me only loads exensions perfectly when called from the CLI, but not when I load pages through Apache.
For example, this is the output of php -m
:
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
filter
hash
iconv
json
libxml
mysqlnd
openssl
pcre
PDO
Phar
readline
Reflection
session
SimpleXML
SPL
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib
However, when run through Apache:
1. In phpinfo()
, OpenSSL support shows up as "disabled".
2. extension_loaded("curl")
is false
3. get_loaded_extensions()
doesn't include curl
or OpenSSL
.
4. Trying to use any of the extensions's functions fails.
Here's var_dump(get_loaded_extensions());
when running through Apache:
array(28) {
[0]=>
string(4) "Core"
[1]=>
string(6) "bcmath"
[2]=>
string(8) "calendar"
[3]=>
string(5) "ctype"
[4]=>
string(4) "date"
[5]=>
string(6) "filter"
[6]=>
string(4) "hash"
[7]=>
string(5) "iconv"
[8]=>
string(4) "json"
[9]=>
string(3) "SPL"
[10]=>
string(4) "pcre"
[11]=>
string(8) "readline"
[12]=>
string(10) "Reflection"
[13]=>
string(7) "session"
[14]=>
string(8) "standard"
[15]=>
string(7) "mysqlnd"
[16]=>
string(9) "tokenizer"
[17]=>
string(3) "zip"
[18]=>
string(4) "zlib"
[19]=>
string(6) "libxml"
[20]=>
string(3) "dom"
[21]=>
string(3) "PDO"
[22]=>
string(4) "Phar"
[23]=>
string(9) "SimpleXML"
[24]=>
string(3) "xml"
[25]=>
string(9) "xmlreader"
[26]=>
string(9) "xmlwriter"
[27]=>
string(14) "apache2handler"
}
OS: Windows 10 1809, up to date.
php -v
:
PHP 7.4.5 (cli) (built: Apr 14 2020 16:17:34) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
httpd
: Apache 2.4.43 Win64 from https://www.apachelounge.com/
PHP and Apache interacting through this in httpd.conf
(mod_php):
LoadModule php7_module "C:/<path_to_PHP>/PHP7/php7apache2_4.dll"
There is only one Apache+PHP install on this machine.
What I've tried:
- Confirmed that PHP is using the same ini file in both modes. If I disable extensions from the ini file, they stop showing in
php -m
(as they should). - (Re)installing MS Visual Studio C++ Redistributable 2015-19 (both x86 and x64).
- Restarting
httpd
. - Restarting PC.
- Reinstalling PHP and Apache.
display_startup_errors=on
and then checking logs. There is no relevant info in both Apache and PHP error logs.- Confirmed PHP is running in ZTS in
php.exe -v
, "Thread Safety" shows up as enabled inphpinfo()
through Apache.
Please help. I need this webserver up and running, and this is driving me crazy.