Phpinfo says the php.ini path is C: \ Windows but php.ini is not there

We are trying to upgrade from PHP5 to PHP7.

Now we have Apache installed, and PHP is working.

However, the changes we made to the php.ini are not affected.

Through phpinfo() we realized that 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" 

I understand that it is assumed that Apache is looking for php.ini in c:\test\php (slashes are used on the http.conf command line)

Not understanding why Apache is not looking for php.ini , where we are talking about it, we put php.ini in C:\Windows , where it still cannot be read (the modules that we load in php.ini are not loaded in phpinfo) .

Each time we make changes to php.ini or httpd.conf , we restart Apache using the Apache monitor.

How can we tell Apache to read the php.ini in a specific directory other than what we tried above?

Addendum:

enter image description here

We switched everything to PHP5 and now we get the same error as in the above screenshot where the PHP path is located. He says that now it is PHP 5.6.0, so it explicitly downloads a new version of PHP, but something has changed, so the php.ini file is not readable in any version. (???)

Rebooting also does not help.

+5
source share
1 answer

You can try adding a trailing slash.

 PHPINIDir "C:/test/php/" 

From manual

Note Remember that when adding path values ​​to Apache configuration files on Windows, all backslashes, such as c: \ directory \ file.ext, must be converted to slashes: with: /directory/file.ext. A final slash may also be necessary for directories.

+2
source

Source: https://habr.com/ru/post/1244870/


All Articles