2

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
David Buck
  • 3,752
  • 35
  • 31
  • 35
mohiris
  • 55
  • 6
  • `display_startup_errors` ? also do `php -i |grep .ini` and see what php.ini file is actually being loaded – treyBake Jul 10 '18 at 09:13
  • your `phpinfo()` should tell you which php.ini file is being used – Karsten Koop Jul 10 '18 at 09:17
  • Configuration File (php.ini) Path => /etc/php/7.2/cli Loaded Configuration File => /etc/php/7.2/cli/php.ini phpinfo() tells me dispay_startup_errors = On and i still have display_errors = Off whereas modified the correct php.ini – mohiris Jul 10 '18 at 09:41
  • so you just need to edit the `/etc/php/7.2/cli/php.ini ` file -> search for display_errors and see how many entries are there, you may have added yours before another one is declared that sets it to off – treyBake Jul 10 '18 at 10:24
  • That's what i explained in my first post... everything is ok in /etc/php/7.2/cli/php.ini – mohiris Jul 12 '18 at 09:34

4 Answers4

2

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

I did found a solution

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

mohiris
  • 55
  • 6
1

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

ace-TI85
  • 11
  • 1
0

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