PHP errors NOT being displayed in the browser [Ubuntu 10.10]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 06:29:47

问题


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.


回答1:


Don't just enable the first occurrence of display_errors in the php.ini file. Make sure you scroll down to the "real" setting and change it from Off to On.

The thing is that if you settle with changing (i.e. uncomment + add = On) by the very first occurrence of display_errors your changes will be overwritten somewhere on line 480 where it's set to Off again.




回答2:


I had the same problem - solved it by setting display_errors = On in both php.ini files.

/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini

Then restarting Apache:

sudo /etc/init.d/apache2 restart

Hope this helps.




回答3:


To make it work you should change the following variables in your php.ini:

; display_errors
; Default Value: On
; Development Value: On
; Production Value: Off

; display_startup_errors
; Default Value: On
; Development Value: On
; Production Value: Off

; error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT 
; Production Value: E_ALL & ~E_DEPRECATED

; html_errors 
; Default Value: On 
; Development Value: On 
; Production value: Off

; log_errors
; Default Value: On 
; Development Value: On 
; Production Value: On

Search for them as they are already defined and put your desired value. Then restart your apache2 server and everything will work fine. Good luck!




回答4:


After you edit /etc/php5/apache2/php.ini be sure to restart apache.

You can do so by running:

sudo service apache2 restart



回答5:


  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




回答6:


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




回答7:


Follow the below steps,

1). Open your php.ini file via sublime through path 
    /etc/php/7.2/apache2/php.ini

2). find display_errors in that file

3). Un-comment these lines of code
      display_errors
      Default Value: On
      Development Value: On
      Production Value: Off

      display_startup_errors
      Default Value: Off
      Development Value: On
      Production Value: Off

      error_reporting
      Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
      Development Value: E_ALL
      Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT

      html_errors
      Default Value: On
      Development Value: On
      Production value: On

4). Save the file and then type the following command in the terminal
     sudo service apache2 restart


your errors are now showing in the browser



回答8:


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.




回答9:


Look at error_reporting directive in php.ini.




回答10:


I was just stuck on the same issue, when I've realized that I was using the open short tag form:

<? echo 'nothing will be print if no open_short_tag option is enabled'; ?>

You have to go to your /etc/apache2/php.ini file and set the short_open_tag = Off to On, then sudo service apache2 restart!

Cheers!




回答11:


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




回答12:


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



来源:https://stackoverflow.com/questions/5050426/php-errors-not-being-displayed-in-the-browser-ubuntu-10-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!