How to show errors in PHP?

If you are having problem in debugging with your PHP web application and want to display all the errors and warnings, then use error_reporting.

The quickest way to display all php errors and warnings is to add these lines to your PHP code file:

ini_set('display_errors', 1); 
ini_set('display_startup_errors', 1); 
error_reporting(E_ALL);
  
For development server 
error_reporting should be set to E_ALL value; 
display_errors should be set to 1


For production server 
error_reporting should be set to E_ALL value; 
display_errors should be set to 0 
log_errors should be set to 1

Related Posts:

  • What is SESSION in PHP ? What is SESSION ? A session is a mechanism to persist information across the different web pages to identify users as they navigate a site or app A PHP session stores data on the server rather than user's computer.  … Read More
  • Installing PHP5.6 on Ubuntu 16.04 Installing PHP5.6 on Ubuntu 16.04 sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php5.6 libapache2-mod-php php5.6-curl php5.6-gd php5.6-mbstring php5.6-mcrypt php5.6-xml php5.6-xmlrpc php… Read More
  • How to show errors in PHP? If you are having problem in debugging with your PHP web application and want to display all the errors and warnings, then use error_reporting. The quickest way to display all php errors and warnings is to add these lin… Read More
  • Installing PHP7.2 on Ubuntu 18.04 Installing PHP7.2 on Ubuntu 18.04 sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php7.2 libapache2-mod-php php7.2-curl php7.2-gd php7.2-mbstring php7.2-mcrypt php7.2-xml php7.2-xmlrpc php7.… Read More
  • Installing PHP7 on Ubuntu 16.04 Installing PHP7 on Ubuntu 16.04 sudo apt-get update sudo apt-get install php libapache2-mod-php php-curl php-gd php-mbstring php-mcrypt php-xml php-mysql php-xmlrpc In case, php-xmlrpc gives not found error use: sudo apt… Read More

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.