0

Every time I have an error within my code and try to run it, the page becomes inaccessible. This is clearly very frustrating as it's hard debugging code with no feedback.

Inaccessible Web Page

Relevant information from cPanel:

Apache version 2.2.22

PHP version 5.3.14

MySQL version 5.1.68-cll

Architecture x86_64

Operating system linux

If more information is required then please ask, I'm sorry I cannot provide any more information but frankly I am stumped.

Thanks.

2
  • 2
    You left out a semi-colon on line 178. Oh wait, we can't magically guess what's going on with the code on your server! Setup your PHP error log and watch it while you hit the page. cyberciti.biz/tips/php-howto-turn-on-error-log-file.html Commented Mar 5, 2013 at 16:38
  • 1
    Since you are using Apache you'll probably find the error in the Apache error log. You don't want errors appearing on production mode sites. Commented Mar 5, 2013 at 16:39

3 Answers 3

1

Enable error reporting to see what error PHP had, if it had one.

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

Comments

1

There are several places you can look, firstly try checking your Apache error log. In many cases this is located in /var/log/apache2/error.log . Another way to debug a page like this is to enable error logging.

The simplest way of doing this being adding these lines to your php file:

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

In addition to this, you can also clean up the errors formatting by adding:

ini_set('html_errors', 'On');

In addition to this method of enabling error reporting, you may also enable them from you configuration file by adding the following line:

error_reporting = E_ALL

3 Comments

I have done this and I have tried to invoke an error, however the web page still fails to load. This is the first time I have encountered this, I haven't changed settings, I don't understand what has changed.
The quickest thing to do right now would be to take a look at your apache logs, if you're getting a 500 error, there should almost definitely be something available there for you to use to troubleshoot the issue.
I looked at the apache logs and I looked into the errors: File does not exist: /home/[Username]/public_html/404.shtml File does not exist: /home/[Username]/public_html/favicon.ico Repeated. Apparently, these are common errors.
0

You need to update your php.ini to display errors. There are a couple settings.

Search your php.ini for display_errors and error_reporting. The file is usually commented very well on the options for error reporting, but error_reporting = E_ALL is a typical setting. Sometimes people want to suppress notices and set error_reporting to E_ALL & ~E_NOTICE.

display_errors = On is the config to print the errors to the screen.

After changing your php.ini, Apache usually needs to be restarted. I'm not sure how much control you have over your server, so if you can't restart Apache but you have a php.ini available, your host probably has it configured so you don't need to restart.

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.