How to check where Apache is looking for a php.ini file?

You can check where Apache is looking for the php.ini file by running the command php --ini in the command line. This will display the configuration file (php.ini) used by PHP, as well as the additional .ini files parsed by PHP.

Watch a course Learn object oriented PHP

Alternatively, you can create a PHP file with the following code:

<?php
phpinfo();
?>

And then access it via a web browser, it will show you all the information about your PHP installation, including the location of the php.ini file.