PHP error reporting

  PurplePenny 23:10 05 May 2004
Locked

I don't get any error messages when I break the code of this PHP that I'm working on, all I get is a blank screen. It makes life difficult to say the least. When I was playing with OsCommerce I saw error messages, and very useful it was too.

When I look at the sites of other people on the users' forum I can see syntax errors and header warnings that their code throws up. If it were the code itself that had turned off error reporting then other people's error messages would be suppressed too. Also I put up a separate little file that just displayed the date and then added:

trigger_error("testing to see whether I get an error message".)

which gave me a blank screen.

Am I right in thinking that this lack of error reporting is because of the way that my php.ini is set?

I contacted my web host to ask about it and was told that I need to use ini_set. So off I went to php.net and looked it up ... and then looked up the things that it told me to see and in the end found this:

ini_set('error_reporting', E_ALL);

I added this to the date file but once either the error trigger or a real error was introduced it was a blank page again.

SO .... is this a job for .htaccess? If so what do I do? I've read pages and pages of php.net documentation and my head is spinning. All I want to do is tell it to display error messages.

Penny

PS You will all be mightily glad to know that I start the Introduction to PHP/MySQL course next week :-)

  Forum Editor 23:55 05 May 2004

It may be the case, although if it is you can still show errors by directory. As you suggest, the way to do this is by placing an .htaccess file in the directory with your php pages.

Your .htaccess should look like this:

php_flag display_errors on

php_value error_reporting 7


The number 7 is the error reporting integer which will mean that normal errors, normal warnings and parser errors will be shown. It's a bit value made up of normal errors(1) normal warnings (2) and parser errors (4)

Does that help?

  PurplePenny 09:46 06 May 2004

"Has your host disabled php.ini on the server?"

I wonder if that is the case. They didn't say anything about it - just that they wouldn't alter a clients php.ini settings for them and I should use ini-set. BUT ... they did have a server disaster a few weeks ago and had to migrate hundreds domains to a new server in a hurry so I maybe it was done by mistake in the rush. (Good customer services: by way of an apology and recompense we all got upgraded to a better hosting package :-))

Thanks FE - I'll try that out the .htaccess this evening.

Penny

  PurplePenny 19:44 06 May 2004

Thanks FE :-*

  Forum Editor 22:41 06 May 2004

Penny.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Alienware 17 R4 2017 review

These brilliant Lego posters show just what children's imaginations are capable of

Mac power user tips and hidden tricks

Comment réinitialiser votre PC, ordinateur portable ou tablette Windows ?