When PHP starts, it reads the configuration file php.ini which contains directives for using PHP. Depending on the mode PHP is running in (CGI, FastCGI, Apache, etc), the configuration file is read only when the server starts or on each execution. Knowing which mode PHP is running in is important, as it will help you determine which php.ini file is being read, and therefore which one you should edit to make your desired changes.
Warning
Remember that any changes you make to the php.ini file will affect all domains configured on the server.
The quickest way to find the path to php.ini would be to use the “locate“ command, but as we mentioned, there are usually several php.ini files on a server, so this option would only be useful for recalling the file's path if you already knew it. In any case, the command to perform the search would be:
# locate php.iniSometimes you may need to update the locate database so that it takes file changes on the server into account. To do this, simply run the following command:
# updatedbAnother way to find the php.ini file would be to use PHP's PHPInfo() function to locate where the php.ini configuration is being read from. You can find more information about using PHPInfo() in the article View the PHP version.