Can't turn On PHP display_errors

1.9k views Asked by At

I am working on Ubuntu 18.04 and for my projects I want PHP to display errors. As sudo, I did:

display_errors = On
error_reporting = E_ALL

Then restart Apache2 service but I still don't get any errors reporting.

I both modified php.ini in apache2 and cli folder and in the 2 versions of PHP (php7.0 and php7.2) on my system.

On phpinfo() I always get:

display_errors = Off
4

There are 4 answers

0
mohiris On BEST ANSWER

I did found a solution

I added this line php_flag display_errors On to my .htaccess file. Errors are now displayed.

0
Litvinenko Sergey On

I had same problem with php 7.1 on my Ubuntu 18.04 (have several versions of php too).

The problem can be is that you need to restart the php-fpm instead apache2.

In my case, I found that a php7.1-fpm have been installed and activated.

Run phpinfo(); and look at the "Server API" row.

If it's something like "FPM" then you need to configure only:

 /etc/php/[current_php_ver]/fpm/php.ini file.

Or look at the "Configuration File (php.ini) Path" row for your php.ini path.

And then run:

sudo service php[current_php_ver]-fpm restart

P.S: Change [current_php_ver] on your current php version, for example:

sudo service php7.1-fpm restart
1
Michael Darcy On

MAMP/bin/php/current-version/conf/php.ini

0
ace-TI85 On

Try editing your php.ini.temp file, if you have one, and restarting your host server.