0

I am new to php ; when ever ther is some error in my script ,the browser do not display error wirh line nymber but displays :

Server error The website encountered an error while retrieving "http://localhost/gmailAPP/google-api-php-client/examples/calendar/simple.php". It may be down for maintenance or configured incorrectly. Here are some suggestions: Reload this webpage later. HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

It is very difficult to debug the code with out error message and line number .Please help

6 Answers 6

1

write:

  <?php

    /**
     * Whether errors should be displayed
     */
    ini_set('display_errors', true);

    /**
     * Set the error reporting level
     */
    ini_set('error_reporting', E_ALL);  // display errors must be turned on

 ?>

and ensure that your .htaccess file has no failure (if you use one).

Note: error_reporting(ERROR_LEVEL) is an alias for the ini_set() method shown above.

Sign up to request clarification or add additional context in comments.

Comments

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

or on your htaccess file

php_flag display_errors on

Comments

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

Comments

1

You can also check the error log directly from the server with the following command

tail /var/log/apache2/error.log

or, to show the last 100 lines

tail -100 /var/log/apache2/error.log

or to output appended data as the file grows

tail -f /var/log/apache2/error.log

You will need to verify the path of your error log, maybe it can change

Comments

0

You need to turn on errors in config file

Comments

0

Try this , put this line in beginning of your PHP file and Check , this is runtime configuration method

<?php
error_reporting(E_ALL);
?>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.