How To Enable Error Reporting In Php.ini In Ubuntu
Contents |
ago mjwittering Like me you maybe using an Ubuntu computer running Apache, MySQL and PHP to develop websites. When ubuntu php display errors developing it is important to see error messages to debug your
Apache Display Errors
code. On occasion I have installed PHP on to Ubuntu computers and by default errors are not
Apache Display Errors Instead Of 500
displayed. As this is not a production web server I updated the php.ini file to display errors. In this post I explain how I updated the php.ini
Enable Php Error Reporting
to display error messages and aid debugging. Open php.ini Start by opening a new terminal window to open the php.ini file. Modifying the php.ini will allow you to tunes the setting to enable more descriptive error messages, logging, and better performance. Enter the following command to begin editing php.ini. This will require the sudo command and apache php error log therefore administrator privileges. sudo nano /etc/php5/apache2/php.ini Display Errors Now scroll down through the file until you find the following line. display_errors = Off Once you have found the display_errors line replace the parameter 'Off' with 'On'. Once you have made the swap save the file and then exit the editor. display_errors = On Restart Apache Now that you have made the change to the php.ini file you need to restart the Apache web server to effect the change. To do this enter the command below into your terminal window to restart the service. Once the service has restarted you will be able to see error message in your PHP scripts instead of blank white pages. sudo /etc/init.d/apache2 restart Links How To Display PHP Errors In My Script Code When Display_errors Is Disabled wallpaperama.com Ubuntu Tips: How do you display PHP error messages? by mjwittering is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Ask Ubuntu BitBucket Delicious DigitalOcean Dribbble Facebook Flickr LinkedIn Twitter
sure you're php error reporting not working enabling this only on development server. It's very ubuntu php ini location common for any developers to make a mistake while developing, which will ubuntu php error log result in White Screen of Death (WSOD). WSOD is normally because PHP error reporting is turned Off. Here's how you http://matthewwittering.com/blog/ubuntu-tips/php-error-messages.html can enable error reporting using PHP.ini file: Open PHP.ini file located at "/etc/php5/apache2/php.ini" using your favorite editor Find and update following variables:error_reporting = E_ALL
display_errors = On If you don't have access or write permission to php.ini, you can still http://yogeshchaugule.com/blog/2015/configure-phpini-show-errors-ubuntu enable error reporting using index.php file: Open index.php file located at "/project-root/index.php" using your favorite editor Add below line of code after the first opening PHP tag:error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE); Reference: Blank pages or "white screen of death" (WSOD) php.ini Error Settings How to enable displaying php errors on site Tags:Drupal 7DebuggingUbuntuPHP ychaugule's blog Add new comment Monthly archive October 2016 (1) June 2016 (1) April 2016 (1) March 2016 (1) November 2015 (1) October 2015 (2) July 2015 (1) May 2015 (2) January 2015 (1) September 2014 (1) 1 of 3 ›› Search Loading blog PHP.it contact Drupal.org Linked.In about.me Twitter.com Facebook Add me to Circle Copyright © 2012-2017, Yogesh Chaugule. back up ↑
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies http://stackoverflow.com/questions/5050426/php-errors-not-being-displayed-in-the-browser-ubuntu-10-10 of this site About Us Learn more about Stack Overflow the company http://stackoverflow.com/questions/6480425/php-not-displaying-errors-even-though-display-errors-on Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: php error Sign up PHP errors NOT being displayed in the browser [Ubuntu 10.10] up vote 44 down vote favorite 11 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 apache display errors 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. php apache apache2 lamp ubuntu-10.10 share|improve this question edited Oct 7 '11 at 16:20 user212218 asked Feb 19 '11 at 11:07 JLove 6781930 What does phpinfo() say about Local value of these settings? What is error_reporting value? How do you check for errors? –Your Common Sense Feb 19 '11 at 12:09 Are you expecting an error or otherwise forcing an error to occur so that you can test this? If so, how are you doing this? Also, what is the exact version of PHP you are running? Be sure to restar
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up PHP not displaying errors even though display_errors = On up vote 28 down vote favorite 9 I have a Ubuntu server running Apache2 with PHP 5. In the php.ini I set error_reporting = E_ALL | E_STRICT and error_reporting = E_ALL | E_STRICT, but PHP is still not displaying error messages. I'm also using Apache virtual hosts. Also, what is the most strict error reporting PHP5.3 has to offer? I want my code to as up-to-date and future-proof as possible. php apache error-reporting share|improve this question asked Jun 25 '11 at 20:46 wowpatrick 1,90773268 what file are you editing for this to happen! –RobertPitt Jun 26 '11 at 16:21 Make sure you check the error_log file, most of the errors are recorded there. –RakeshS Jun 27 '11 at 4:01 add a comment| 11 Answers 11 active oldest votes up vote 49 down vote accepted You also need to make sure you have inside your php.ini the following set set: display_errors = On Or errors will go only to the log that is set by default or specified in the virtual host's configuration. The php.ini file is where base settings for all php on your server, however these can easilybe overridden and alterd any place in the PHP code and affect everything following that change. This happens a in frameworks. A good check is to add the display_errors to you php.ini. If you don't see an error, but one is being logged, insert this at the top of the file causing the error: ini_set('display_errors', 1); error_reporting(E_ALL); If this works then something earlier in your code is disabling error display. share|improve this answer answered Jun 26 '11 at 16:16 Ray 19.7k43976 3 I missed too at first but the question title says that display_errors is On. –Arvin Jun 26 '11 at 16:27 echo 'Thanks a lot!'; –Umair Apr 10 '14 at 12:20 Also, make sure that the is no overwrite of this config later on, as is often the case in legacy code. –afilina Apr 1 '15 at 19:17 this worked fine for me , thanks –AMB Jun 22 '15 at 17:48 This worked for me when I was working for a client who was running IIS (IIS !?!?) –Ni