Php.ini changes don’t have any effect

apache-2.2PHPphp.ini

When I make any changes in php.ini located in /usr/local/lib on centos, the changes don't appear to be applied, for example, when I clear all the content of php.ini and restart Apache everything works fine…

I searched for php.ini and it is in one place in system… what's the problem? How can I fix this?

Best Answer

if you're unsure what php.ini is being used, create a new file in your webfolder, name it phpinfo.php for example , with the following content

<?php
phpinfo();
?>

then open the url in your browser (http://www.example.com/phpinfo.php). it will show the path to the php.ini being used.

when you have identified the correct file, make your desired changes, and be sure to remove the leading ; in case there is one to activate the setting.

restart apache and reload the phpinfo page, your changed setting should now show up. if it doesn't, make sure you don't have a .htaccess file in your webroot that overrides php settings.