'*** ERROR *** The PHP configuration loaded file is: c:/wamp64/bin/php/php8.1.0/php.ini - should be: c:/wamp64/bin/apache/apache2.4.53.1/bin/php.ini

I updated from PHP 7.4.26 to PHP 8.1.0

I am getting the following error on localhost home page although website is working on server:

ERROR The PHP configuration loaded file is: c:/wamp64/bin/php/php8.1.0/php.ini - should be: c:/wamp64/bin/apache/apache2.4.51/bin/php.ini or c:/wamp64/bin/php/php8.1.0/phpforapache.ini You must perform: Right-click icon Wampmanager -> Refresh

  • This file is only for PHP in Command Line.

How can I load the correct php.ini or make the error disappear?

Thanks.

Update: Please click below

Screenshot

httpd-vhosts.conf


# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "c:/wamp64/www"
    <IfModule fcgid_module>
    Define FCGIPHPVERSION "8.1.0"
    FcgidInitialEnv PHPRC ${PHPROOT}${FCGIPHPVERSION}
    <Files ~ "\.php$">
      Options +Indexes +Includes +FollowSymLinks +MultiViews +ExecCGI
      AddHandler fcgid-script .php
      FcgidWrapper "${PHPROOT}${FCGIPHPVERSION}/php-cgi.exe" .php
    </Files>
  </IfModule>
    <Directory "c:/wamp64/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>
#

PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\bhavi\AppData\Local\Microsoft\WindowsApps;

httpd.conf contains:

PHPIniDir "${APACHE_DIR}/bin"
LoadModule php_module "${INSTALL_DIR}/bin/php/php8.1.0/php8apache2_4.dll"

LoadModule fcgid_module modules/mod_fcgid.so
<IfModule fcgid_module>
  FcgidMaxProcessesPerClass 300
  FcgidConnectTimeout 10
  FcgidProcessLifeTime 1800
  FcgidMaxRequestsPerProcess 0
  FcgidMinProcessesPerClass 0
  FcgidFixPathinfo 0
  FcgidZombieScanInterval 20
  FcgidMaxRequestLen 536870912
  FcgidBusyTimeout 120
  FcgidIOTimeout 120
  FcgidTimeScore 3
  FcgidPassHeader Authorization
  Define PHPROOT ${INSTALL_DIR}/bin/php/php
</IfModule>


Solution 1:[1]

Search your apache server files for PHPINIDir. In XAMPP it is under \apache\conf\extra\httpd-xampp.conf. My PHPINIDir directive looks like:

<IfModule php7_module>
    PHPINIDir "P:/xampp7.3/php"
</IfModule>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 w. Patrick Gale