New Feature Announcement: Master Your Email Delivery with the Mail Delivery Center

How do I enable error logging in my PHP script?

Introduction

You may need to troubleshoot a site's PHP script--for example, if the site appears as a blank page. A helpful way to troubleshoot these scripts is to enable error-logging in the script.


Procedure

Some PHP scripts that are part of an application may include an option to enable a development or testing environment. When you enable this environment, the script logs errors to the local error_log file in the site's document root.

If your script does not include such an option, you can add these lines directly into the script, which forces the script to output any errors to the local error_log file:

error_reporting(E_ALL);
ini_set('display_errors', 1);

You can then review the errors in the error_log file to determine why the script is not functioning correctly.

  • 262 Users Found This Useful
Was this answer helpful?

Related Articles

 Connect to your server via SSH

SSH allows secure file transfer and remote logins over the internet. Your connection via SSH is...

 How to force your site to use SSL (HTTPS) using

First of all, you will need to install an SSL certificate to your siteOnce your certificate is...

 How do I change PHP versions, or change my PHP settings / config?

The process of setting your PHP version and the 'variables' (such as memory_limit values) differs...

 How do I install a free SSL via cPanel?

Installing an SSL certificate in cPanel is easy! Best of all, it's free with WebGee!Important:...

 How to send emails in WordPress using the WP SMTP Mail plugin

Instead of using the default PHP mail() function, you can send emails using our SMTP services via...

Powered by WHMCompleteSolution