InMotion Hosting Support Center

In this tutorial:

There are two methods for viewing PHP errors that occur while running your website. You can either display errors directly on your website (viewable from any web browser) or enable error logging to write the errors to a specified file (viewable inside a text file). This article will cover how to turn display_errors On and Off, adjust error reporting settings, configure error logging, and use the ini_set() function to help troubleshoot PHP errors with your website.

Editing the php.ini to Display Errors

While your site is live, the php.ini file should have display_errors disabled for security reasons. However, for the development environment, display_errors can be enabled for troubleshooting. Displaying errors should be disabled while the site is live, to protect sensitive information and not interfere with the format of your website pages. When display_errors is On, your site's pages will display any PHP errors encountered when loading your website in a browser. This section will explain how to control error reporting and turn display_errors On and Off.

  1. Log into your cPanel.
  2. Go to the File Manager. Select the home directory for your website (by default: public_html) and click Go.
  3. Report all PHP errorsFind the "Error handling and logging" section in the php.ini. In order to display or log errors, you need to enable error_reporting by removing the ( ; ) from in front to the line. You can disable error_reporting by adding a ( ; ) in front of the line. Refer to the code below:

    Error reporting disabled:

    ;   - Show all errors, except for notices
    ;error_reporting = E_ALL & ~E_NOTICE

    Error reporting enabled to specifically report all errors, but not notices:

    ;   - Show all errors, except for notices
    error_reporting = E_ALL & ~E_NOTICE

  4. Display PHP errors OnNext you can set the display_errors variable to On or Off to either show the errors on your website or not. Look for the display_errors line in the php.ini file and set it to On to display errors or Off to turn not display errors. The code looks like the following:

    Display errors:

    display_errors = On

    Do not display errors:

    display_errors = Off

php.ini Error Reporting Settings

List of PHP Error reporting settingsPHP has a list of different error reporting settings within the php.ini file itself. For example, if you want to display only warnings you can change the error_reporting line to the following:

error_reporting = E_WARNING

The following table was created from the settings found in a standard php.ini file. Refer to the following table for the available options.

List of available options taken from php.ini
E_ALL All errors and warnings
E_ERROR fatal run-time errors
E_WARNING run-time warnings (non-fatal errors)
E_PARSE compile-time parse errors
E_DEPRECATED notices for the use of functions that will be retired in a future version
E_NOTICE run-time notices (these are warnings which often result from a bug in your code, but it's possible that it was intentional (e.g., using an uninitialized variable and relying on the fact it's automatically initialized to an empty string)
E_CORE_ERROR fatal errors that occur during PHP's initial startup
E_CORE_WARNING warnings (non-fatal errors) that occur during PHP's initial startup
E_COMPILE_ERROR fatal compile-time errors
E_COMPILE_WARNING compile-time warnings (non-fatal errors)
E_USER_ERROR user-generated error message
E_USER_WARNING user-generated warning message
E_USER_NOTICE user-generated notice message

Turning Error Logging On

By default errors are written to the error_log, which is set to /dev/null. This means, error logging won't occur. When errors are turned on, errors will be stored in a file in the directory the error occurs in. For example, if you have a PHP file called index.php in a subdirectory like public_html/wordpress, if you have any PHP errors while running that file's scripts, the error log will be stored in that folder (public_html/wordpress). You can specify (in the php.ini) which file to store all errors in.

The IfModule causes Apache to load the directive only if suPHP is used, so the site doesn't break if switched to another PHP handler such as DSO.

For more information on suPHP and DSO please see our article on Choosing the best PHP handler.

  1. Log into your cPanel.
  2. Go to the File Manager. Select the public_html directory and click Go.
  3. Log PHP errors OnYou can set the following line of code to On to log errors or Off to turn error logging off.
    log_errors = On

  4. Path to PHP Error logNext you can save errors from any page in your files to a specific location by specifying the error_log. The example below uses a file named error_log

    This will place the error_log in the directory the error occurs in:

    ; Log errors to specified file.
    error_log = error_log

    This will write all errors to the error_log file inside the public_html directory, regardless of what directory the errors were encountered in:

    ; Log errors to specified file.
    error_log = /home/userna5/public_html/error_log

Using int_set() to Display Errors

In the case you want errors to not display site wide and you want to check errors on a single page, you can use the ini_set() function to have errors displayed on a particular page. The basic syntax from shows the function and its parameters is as follows:

string ini_set ( string $varname , string $newvalue )

This can be placed at the top of your PHP page, with the error_reporting variable in it, to allow error checking for that particular page. Below are the steps for how to do this.

  1. Log into your cPanel.
  2. Go to the File Manager. Select the public_html directory and click Go.
  3. Navigate to the PHP file you want to check errors for.

    Open the file in the code editor.

  4. In the file, add the following at the top.
    ini_set('display_errors', '1');

    1 = On
    0 = Off

    Save the page.

    Now your PHP page only will display errors.

Maintain Your Log Files

Now that you have enabled error logging, be sure to maintain your log files. If you are getting errors regularly, be sure to remove the logs periodically. You may do so by just removing the file from within the File Manager or through any other method that you prefer to manage your files. A large log file can sometimes cause issues by possibly filling your disk space or if on shared hosting with unlimited disk space, begin to impact other customers on the server.

Was this article helpful?

Related Questions

Here are a few questions related to this article that our customers have asked:
Error message when calling Docebo
Does InMotion Hosting use security that blocks XML RPC protocol?
phpmailer does not send
Errors: Depreciation on website and cannot get module data
500 internal error after publishing site with construction page
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Forum Login

You are NOT logged in. You can still browse our Support Center.

To participate within our Community Support Forum:

n/a Points
2019-03-06 6:04 pm


I read the document to edit the php.ini, however, I couldnt find this file in my instalation in the folder public_html. So, I just created it and place the changes that I would like in the setup of PHP. Is that right?




3,820 Points
2019-03-08 6:31 pm
Depending on your cPanel version, you may need to use cPanel to modify the php.ini file to customize it.
n/a Points
2019-02-08 5:37 pm

Hello, I got an HTTP ERROR 500 from the website i designed using joomla and i can't figure out how to solve this problem. Kindly help out

3,820 Points
2019-02-11 1:23 pm
I'm sorry to see that your website is displaying an HTTP 500 Error. Were you able to find an error message with more details by following the instructions in the guide above? Those details would be necessary to diagnose and find a solution to resolve the error.

If you are a customer of InMotion Hosting I recommend contacting our Live Technical Support for more private/personal assistance.
n/a Points
2018-05-03 12:42 am


Sorry there was an error sending your form.
  • mail:Could not instantiate mail function.
  •  why is this???????
31,595 Points
2018-05-03 10:08 am
We are happy to help but will need some additional information. Can you provide a link to the form for us to test?

Thank you,
n/a Points
2017-08-07 1:25 pm

In "turning error logging on" you mention adding

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/USERNAME/public_html

to the local .htaccess file to to enable local settings. Does this ADD TO or SUPERCEDE the settings in  higher-level .htaccess files (IE in the directories above?)

11,043 Points
2017-08-07 3:18 pm
Htaccess in the nearest directory would take precedent over php.ini and a higher-level .htaccess file.
n/a Points
2017-08-07 3:34 pm

So the local .htaccess file should include code from any higher-level .htaccess files (IE in my home directory) to retain that functionality?

11,043 Points
2017-08-07 4:01 pm
The code does not require repetition. The .htaccess in the higher level is recursive, meaning it will affect directories below it.
n/a Points
2017-07-03 5:24 am

Nice tutorial. This tutorial was really helpful to known the error reporting in PHP. This is helpful to beginners. Thanks.

n/a Points
2016-05-11 5:18 pm

Do I need to setup anything to make php work? It seems the php interpreter works, but it does not work with function calls.

42,943 Points
2016-05-11 5:39 pm
Hello Hung Nguyen,

Sorry for the problem with your PHP functions. The servers are all loaded and ready to run PHP, so you don't need to do any configuration. If your functions aren't working, then it may be related to your code. We do not provide coding support so you may be better off posting your code in a forum specifically for that purpose. You may also want to check your PHP configuration in the cPanel for the PHP version being used.

If you have any further questions or comments, please let us know.

Arnel C.
n/a Points
2016-03-09 12:08 am

hi, im using joomla 3.4.8 version for my website and a error seems to be keep on repeating "PHP Notice: Undefined index: HTTP_HOST in /home/novelteamnew/public_html/libraries/joomla/uri/uri.php on line 174". i dont knw how to handle this? can anyone help with this??


42,943 Points
2016-03-09 6:30 pm
Hello Guruprasad G,

Sorry for the problems with Joomla. I tried looking for information on this error and this is what I found: Joomla forum post. It may help with your issue, or at least help get you going in the right direction.

I hope that helps to answer your question! If you require further assistance, please let us know!

Arnel C.
n/a Points
2015-08-22 6:57 pm

I am in need of editing my php.ini file. The article says that the php.ini file is located in the public_html directory, but the file isn't there. Am I looking the wrong place?

10,077 Points
2015-08-24 3:27 pm
Hello Ashleyka,

That is the correct location but it may have been removed. I would suggest contacting the technical support department of your host to have a copy added to your public_html so you may make edits.

Best Regards,
TJ Edens
n/a Points
2015-01-22 8:38 am

Hi sir,

I am php developer , I have some problem I want to know about error log becouse client demand to error log, show error message and save in db with all error detals and remove by user.(means client). how to solve problem .

42,943 Points
2015-01-22 10:01 am
Hello Anant,

Thanks for the question. We can't help you with code, but we can try to provide some guidance that will lead to what you need. I found this post in a forum concerning your question:

"Use set_error_handler('myErrorFunction'); (See PHP Manual set_error_handler) define myErrorFunction with database inserts, turn off standard error reporting display with ini_get('display_errors', 0);"

(How to save PHP errors in Database)

I hope this helps to answer your question, please let us know if you require any further assistance.

Arnel C.
n/a Points
2015-01-05 7:57 am

In joomla backend i am getting this error 

An error has occurred.

 0 String could not be parsed as XML

 Return to Control Panel

due to this error i am not able to open the backend. Please any body can helpme. 

42,943 Points
2015-01-05 11:26 am
Hello Sudhanshu Kumar,

Sorry for the problem. The issue you're having has been reported in the Joomla Forums here. Your best bet is to follow their suggestions and see if it doesn't resolve the problem you're seeing.

Kindest regards,
Arnel C.
n/a Points
2014-07-05 3:05 pm

We can easily turn on or off wordpress error reporting with just one line code in wp-config.php. Here is the link for code

n/a Points
2014-05-02 8:31 am


 if(isset ($_POST['user'])){

     $user = $_POST['user'];

     $pass = $_POST['pass'];


     $con = mysql_cnnection("lochost","root"'"");

       if(!$con){die(Could not connect: '.mysql_error());}


  if(mysql_num_rows(mysql_query("SELECT * FROM user where username = '$user AND password = '$pass'")))


  $result =mysql_query("SELECT * FROM users where username ='$user' AND password ='pass'");

  while($row =mysql_fetch_array($result))


  $expire =time()+60*60*24*30;





    echo"<br>username or password</b><br><br>";





    echo"<form method = 'post'>

   Username:<input type='text' name='user'><br>

   Password:<input type='password' name='pass'><br>

   <input type='submit' value='LOGIN'>



31,595 Points
2014-05-02 9:13 am
Hello Rakesh,

Thank you for contacting us today. Do you need assistance? Are you having trouble with this script? Are you getting any errors?

If you have any further questions, feel free to post them below.
Thank you,

n/a Points
2014-07-06 8:17 am

hello friend i am php devloper 

i one site devlopd but one erro 

send mail function not work in public_html and i create public_html in any folder in check to work adn run 

this  code same  in public_html and any foldre 

n/a Points
2014-07-06 8:25 am

i am sanjay and php developer  but one error 

i am send mail function code is wright in public_html in any foulder to run this code 

but error in public_html in my page run mail.php this error 

 PHP Startup: Unable to load dynamic library '/opt/php54/lib/php/extensions/no-debug-non-zts-20100525/' - /opt/php54/lib/php/extensions/no-debug-non-zts-20100525/ cannot open shared object file: No such file or directory in Unknown on line 0
9,968 Points
2014-07-06 4:06 pm
Hello sanjay,

It looks like you might want to edit your php.ini file and look for the line that mentions and comment it out by placing a ; in front of that line and then saving it.

You might want to check with your host if the main PHP mail() function is disabled on your server.

You might want to use phpMailer to send mail from your website instead using the SMTP authentication that a normal email client would use.

Please let us know if you have any further questions.

- Jacob

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

30 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!