Current location: Hot Scripts Forums » Programming Languages » PHP » PHP error reporting


PHP error reporting

Reply
  #1 (permalink)  
Old 08-30-07, 10:04 AM
Balkee867 Balkee867 is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
PHP error reporting

It seems like a simple answer, but I just switched my host and now I don't get the default PHP errors that I got with my old host. Now when there's an error in my script the page displays blank, instead of the standard error notice. Even if I use or die("message"); it will still show blank. How can I fix this?
Reply With Quote
  #2 (permalink)  
Old 08-30-07, 10:13 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Try creating an .htaccess file with this:
Code:
php_value error_reporting 6135
Or try putting this at the top of your script.
PHP Code:

error_reporting(E_ALL E_NOTICE); 

Reply With Quote
  #3 (permalink)  
Old 08-30-07, 10:14 AM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
Edit: basically says the same as above, however if you are getting a blank screen and none of your die(...) messages are output, it is likely you have a fatal parse error and you will only see these due to settings made in a .htaccess file (or checking your web server log for errors.)

You can put the following lines in a .htaccess file -
Code:
php_value display_errors On
php_value error_reporting 6143
Unfortunately, a .htaccess file does not have access to any of the PHP defined constants, like E_ALL, so you must use the corresponding value for the error reporting level you want to set.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???

Last edited by mab; 08-30-07 at 10:18 AM. Reason: Nico was typing quicker this time...
Reply With Quote
  #4 (permalink)  
Old 08-30-07, 11:44 AM
Balkee867 Balkee867 is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
I tried both and for some reason it still displays blank. Should the .htaccess file be in the same directory as the pages?
Reply With Quote
  #5 (permalink)  
Old 08-30-07, 12:57 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
A .htaccess file affects the current folder and any sub-folders that that folder contains (provided your hosting provider has not prevented you from making changes to any specific settings and that you are on an Apache web server.)

Some things to try -

Create a php file with a phpinfo() statement in it and browse to this file. Find/scroll till you find the settings for display_errors and error_reporting. If the "local" values match your .htaccess settings, then the .htaccess file worked.

Do any php scripts work or do they all give blank pages?

Are you using short open php tags <? or full opening php tags <?php

Browse to your web page and do a "view source" in your browser and see what might be there. If an error is output inside of some "open" tags (forms mainly) they won't necessarily be rendered by the browser, but they are visible in the source of the page in the browser.

Check your web server log for errors.

Post the code for one of your files that does not work so that someone here can see is there is something that stands out as being a problem.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 10:17 AM
PHP Downside--Solutions? Amulet PHP 10 07-15-05 08:26 AM
PHP multi-dimensional array sorting issue aqw PHP 2 06-24-05 11:09 PM
PHP / Graphic Developers someotherguy582 Job Offers & Assistance 1 06-05-05 07:40 PM


All times are GMT -5. The time now is 06:09 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.