InMotion Hosting Support Center

In this tutorial:

By default, InMotion disabled PHP error logging on all servers. In order to troubleshoot your PHP code, PHP errors can be enabled to display and log errors using your local php.ini file or ini_set() in a specific PHP file. This article will cover how to turn display errors On and Off, error reporting settings, error logging, and the ini_set() function for individual error checking on specific pages.

Editing the php.ini to display errors

The php.ini by default should have the errors enabled; however, for the production environment, errors can be turned off. Sometimes when developing PHP scripts you may want to turn specific errors Off or On. Displaying errors is typically turned-off for production and Enabled for development. Displaying errors is disabled for production to protect sensitive information and not interfere with the format of the pages. This section will explain how to turn error reporting On and Off.

  1. Login into your cPanel.
  2. Go to the File Manager. Select the public_html directory and click Go.
  3. Report all PHP errorsFind the "Error handling and logging" section in the php.ini. You can enable the error_reporting by removing the ( ; ) from in front to the line. You can disable error_reporting by adding a ( ; ) in front of the line and add "error_reporting = none". See the following.

    Error reporting set to server default.

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

    Error reporting set to specifically report all errors.

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

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

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 just want to display warnings only you can change the error_reporting to the following.

error_reporting = E_WARNING

The following table was created from the settings found in a standard php.ini file. The following table shows 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 set to error_log is set to /dev/null which means, it won't have error logging on. When errors are turned on will be stored 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 in the index.php file of that location, the error log will be stored in that folder. You can specify in the php.ini what file to store all errors in.

Important!You can place the following code in the .htaccess to make the local php.ini work for the current directory where the .htaccess resides and all subdirectories beyond.

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/USERNAME/public_html
The IfModule makes Apache 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 please see our article on Choosing the best PHP handler.

  1. Login 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 the error_log for all your to a specific path on the server or leave the log.

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

    ; Log errors to specified file.
    error_log = error_log

    This s will place all errors in the error log inside the public_html

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

    Now your errors will all be stored in the error_log in the public_html.

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 to with the error_reporting variable in it to allows error checking for that particular page. Below are the steps on how to do this.

  1. Login into your cPanel.
  2. Go to the File Manager. Select the public_html directory and click Go.
  3. If error logging is off in php.ini you can place this in a page for errors specific to this page Place the following
  4. Navigate to the PHP file you want to check errors for.

    Open the file in the code editor.

  5. In the page, add the following to the top of the page.
    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.

Support Center Login

Social Media Login

Social Login Joomla

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 Server Error
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
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'>



27,915 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
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
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. 

37,289 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
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 .

37,289 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-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
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??


37,289 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
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.

37,289 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.

Post a Comment

Email Address:
Phone Number:

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

16 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!