I can't get php to repect its php.ini settings

I have altered the line in php.ini about the errors, by using display_errors = On.
Then I do a ‘sudo apachectl restart’ but when I run php_info() function again I see that the display_erorrs are still Off.
I am changing the /etc/php.ini that php_info() function shows as the configuration file path.
Any ideas?

Check if any additional ini files are loaded, “Scan this dir for additional .ini files” in phpinfo() output, the setting might be changed there. Also this setting is PHP_INI_ALL, which that value can be set anywhere. So, the next thing to check would be apache config and .htaccess file.

‘Scan this dir for aditional .ini files’ is (none).

Apart from other settings overriding your ini, as @ronalds; says, you also have to check your error_reporting level is set to show a low enough level of errors for them to be worthy of being shown at all.

Start on a single page like this:


<?php

error_reporting(E_ALL);
ini_set('display_errors','On');

$arr = array();
echo $arr[1];

// should get you an "undefined offset" error

?>

Then uncomment the first 2 lines, check if there is an .htaccess file in this folder, or above it.

Then check your httpd.conf file carefully, especially for the VirtualHost directives for this site.