1

How can I determine why a PHP page on my web-host has not compiled?

Where are the compiler errors logged to?

2
  • Compiler or interpreter? Commented Nov 14, 2012 at 12:39
  • On my shared host, they're in a log file in the same directory as the PHP. Commented Nov 14, 2012 at 12:42

5 Answers 5

3

Should be in the same directory as the file that runs the code. Switch all error reporting on with:

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

ini_set('error_log', 'script_errors.log')  // change here
ini_set('log_errors', 'On')
Sign up to request clarification or add additional context in comments.

2 Comments

Is there a way to have all these errors written to a file of my choice?
I think, but dont hold me to it, something like this: ini_set(‘error_log’, ‘script_errors.log’) ini_set(‘log_errors’, ‘On’)
2

Try This:

Put the following code on the top of your file:

ini_set("log_errors", 1);
ini_set("error_log", "/path/to/php-error.log");

For more information please read bellow mention articles.
http://perishablepress.com/advanced-php-error-handling-via-php/
http://www.cyberciti.biz/tips/php-howto-turn-on-error-log-file.html

Comments

0

You can find it in cPanel of your host.

but some hosts combined all errors from all sites on the same server in one log file.

you have to search for your own errors.

Comments

0

There's no such thing as compiler errors in PHP. Every error that occurs is sent directly to the browser in form of HTML data. Check that you have set error_reporting(E_ALL); and display_errors(1); in your script.

3 Comments

Whenever my PHP pages have some kind of syntax error they return The remote server returned an error: (500) Internal Server Error.
That's likely because you dont have error reporting on and it outputs 500 error as there is no error handler, with error reporting on, it will be 400, but list the details of the errors.
0

PHP not normally being compiled, I guess you are looking for runtime errors. How to display runtime errors can be controlled with the error_reporting() method.

That said, there are indeed PHP-compilers like HipHop by Facebook, so if "compiler errors" are what you are looking for, I believe you will have to elaborate a bit further on your question.

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.