PHP errors NOT being displayed in the browser [Ubu

2019-01-06 10:20发布

I'm new to PHP and the whole LAMP stack but I've managed to get it up and running on my Ubuntu 10.10 system. Everything seems to be working with the exception of error reposting in the browser which I just can't seem to get working (and which I can't work without!).

I've read a number of article and other threads which indicate that the following values should be applied in the file /etc/php5/apache2/php.ini:

  • display_errors = On
  • display_startup_errors = On

I've restarted apache2 and even restarted my computer but for the life of me I just can't get it working. I've even tried using phpinfo() function which reports that these settings are as I've set them so I know it's picking up the correct configuration file but nothing!

Any help would be welcome.

12条回答
一纸荒年 Trace。
2楼-- · 2019-01-06 10:43

Look at error_reporting directive in php.ini.

查看更多
The star\"
3楼-- · 2019-01-06 10:46

If you have Local Values overriding master values, you won't change its values in php.ini take a look for those variables in a .htaccess or in the virtual-host config file.

...

        php_admin_value display_errors On
        php_admin_value error_reporting E_ALL
</VirtualHost>

If you edit vhost, restart apache,

$ sudo service apache2 restart

.htaccess edits don't need apache to restart

查看更多
孤傲高冷的网名
4楼-- · 2019-01-06 10:48
  1. First you need to find the path to the php.ini file
  2. You will find the file in the specified path /etc/php/7.0/apache2/. If you are changing the values in the CLI folder or the CGI folder it will not work.
  3. Make the following changes

display_errors = On

  1. Restart you apache server

/etc/init.d/apache2 restart

查看更多
我想做一个坏孩纸
5楼-- · 2019-01-06 10:49

Use the phpinfo(); function to see the table of settings on your browser and look for the

Configuration File (php.ini) Path

and edit that file. Your computer can have multiple php.ini files, you want to edit the right one.

Also check display_errors = On, html_errors = On and error_reporting = E_ALL inside that file

Restart Apache.

查看更多
Emotional °昔
6楼-- · 2019-01-06 10:55

it's should overlap, so it turned off. Try to open in your text editor and find display_errors and turn it on. It works for me

查看更多
劳资没心,怎么记你
7楼-- · 2019-01-06 11:00

Try adding log_errors = Off and check the error_reporting setting whether it's set high enough.

查看更多
登录 后发表回答