Jump to content

display_errors is off on host, but I want to see my errors


jonshutt

Recommended Posts

Hi folks,

 

Just been looking at hosting with 'steamline net hosting', and testing some PHP scripts

 

They have the 'display_errors' setting to 'OFF' in their ini setting. http://nld.streamlinenettrial.co.uk/info.php

 

The problem is that if i'm testing scripts, I don't get any of the useful feedback letting me know where the error is etc, I just get a completely blank screen.

 

I've tried various ways of turning it on including:

ini_set('display_errors', 1);
error_reporting(E_ERROR | E_WARNING | E_PARSE);

 

but the problem seems to be a bit of a paradox:

If I have an error in the page, the fail doesn't run, and the line telling it to show errors doesn't run, and I end up getting nowhere!

 

Is there any successful way around this problem? or is it just a question of finding a different host?

I've asked if they can change the settings, but they just said no, as it's shared hosting, and changing setting would affect other sites...

 

thanks for any help

 

jon

Link to comment
Share on other sites

Thanks, I tried that code, but it didn't actually work.

 

<?
ini_set('error_reporting', E_ALL);
print "sdsdfd";
print "sdf

?>

 

first line should turn on error reporting, 2nd line is ok, line 3 has a mistake, which on other servers returns the error 'Parse error: parse error, unexpected $ in /usr/local/psa/home/vhosts/invernessmc.com/httpdocs/test.php on line 3'

 

but in this case, it just gives me a blank page.

 

Am I going about this the wrong way, or is there a problem with the host's settings?

Link to comment
Share on other sites

Ok, it seems to work when I have errors such as '$a = 1/0', which are mathematical kind of errors.

 

But it doesn't work when I structural errors, such as when I make mistakes such as leaving a bracket off a line. eg "$a = ((4+5);"

 

I think I'm looking at Parse Error issues here...

i find these really useful when writing code...

Link to comment
Share on other sites

i would do

ini_set('error_reposrting', E_ALL ~E_NOTICE);

 

this ignores NOTICE: undefined $var

 

meaning if you have not defined a variable but use one on your page

you either use @ to silence it ie: @$_GET['var'];

or you turn off E_NOTICE :)

Link to comment
Share on other sites

For This you must have to set display_error = On in php.ini

 

and set

 

error_reporting  = E_ALL

 

and for others set like this

 

;error_reporting = E_ALL & E_NOTICE

;error_reporting = E_ALL & ~E_NOTICE | E_STRICT

;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR

;error_reporting  = E_ALL & E_NOTICE ; display all errors, warnings and notices

 

i mean to say only one "error_reporting" should have to enable.

Link to comment
Share on other sites

error_reporting should be able to be set in your code - if its not working try uploading a file called php.ini to the directory this script is in and have

 

error_reporting set to something that will show the errors you need (table of values which can be version specific can be found here)

 

alternatively have a look at error_reporting().

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.