Where is the php.ini file on a Linux/CentOS PC?
On a CentOS system, the php.ini
file is usually located in the /etc
directory. To find the location of the php.ini
file on your system, you can use the phpinfo()
function in a PHP script.
Here is an example of how you can use phpinfo()
to find the location of the php.ini
file:
<?php
phpinfo();
?>
Watch a video course
Learn object oriented PHP
Save this script as "info.php" and place it in your web server's document root (e.g. /var/www/html
). Then, access the script in your web browser by visiting http://your-server-name/info.php
.
This will display a lot of information about your PHP installation, including the path to the php.ini
file. Look for the "Loaded Configuration File" row in the output to find the path to the php.ini
file on your system.