Can't enable error messages for PHP on my web server

I’m trying to disable error messages for PHP on my Apache2 web server, but it’s not working.

I have enabled it in the php.ini file.

error_reporting = E_ALL

I deliberately introduced errors in my test.php script, and in the script itself, I have included the following, but no errors are displayed.

init_set('display_errors', 1);
init_set('display_startup_errors', 1);
error_reporting(E_ALL)

What am I doing wrong?

Asked By: Jasmin

||

The php.ini file, located at /etc/php/7.3/cli/php.ini, is only responsible for the command line interface.

If you use the echo phpinfo(); function in a script to display your configuration, you will see the following lines:

Configuration File (php.ini) Path
Loaded Configuration File

The lines will show the path as /etc/php/7.3/apache2 and /etc/php/7.3/apache2/php.ini for your Apache2 web server.

To edit the configuration for your Apache2 web server, you need to modify the file /etc/php/7.3/apache2/php.ini.

So, there are two php.ini files available.

Answered By: Blockchain Office
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.