We are trying to switch from PHP5 to PHP7.
We now have Apache installed and PHP works.
However, the changes we made in the php.ini
file have no effect.
Via phpinfo()
we realized the reason is that the Configuration File (php.ini) Path
is C:\Windows
.
In our httpd.conf
we have:
# PHP7 setup
LoadFile "C:/test/php/php7ts.dll"
LoadModule php7_module "C:/test/php/php7apache2_4.dll"
AddHandler php7-script .php
PHPINIDir "C:/test/php"
Which I understand is supposed to make Apache look for the php.ini
in c:\test\php
(forward slashes are used in the http.conf as is required)
Not understanding why Apache doesn't look for php.ini
where we tell it to, we put the php.ini
in c:\Windows
where it still is not read (the modules which we load in the php.ini
are not loaded in phpinfo).
Each time we make changes to php.ini
or httpd.conf
, we restart Apache with the Apache monitor.
How can we tell Apache to read the php.ini
file in a specific directory other than what we have tried above?
We switched everything back to PHP5 and now get the same error as in the above screenshot for where the PHP path is. It says it is now PHP 5.6.0 so it is obviously loading the new PHP version but something has changed so that the php.ini file is not read in either version. (???)
A reboot doesn't help either.
user. ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. This file is located on your server in the /public_html folder.
Check php. ini in CLI (Command Line Interface): To know about php. ini, simply run on CLI. It look for Loaded Configuration File in output for the location of php.
You can try add trailing slash
PHPINIDir "C:/test/php/"
From manual
Note: Remember that when adding path values in the Apache configuration files on Windows, all backslashes such as c:\directory\file.ext should be converted to forward slashes: c:/directory/file.ext. A trailing slash may also be necessary for directories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With