I upgraded my localhost server's php on Windows 10 machine and had difficulty getting the correct php.ini file to load.  

According to phpinfo(), the correct php version 8.3.4, was running, but the Loaded Configuration File continued to load from the folder containing the previous version php code.  Interestingly, the previous version php path was no longer in the PATH environment variable. 

Searches for problems with php.ini were all over the place, but eventually on Stack Exchange serverfault I saw reference to an Apache Configuration file directive: PHPIniDir.  So I searched my Program Files folder for any reference to PHPIniDir and found ApacheLounge\Apache24\conf\httpd.conf with the directive set to the previous php version's folder.

I changed it to .../ProgramFiles/php-8.3.4 and it worked!