PHP 5 upgrade brings down website - any ideas?

Associate
Joined
20 Oct 2002
Posts
680
Hi All. A friend of mine has a fairly simple PHP driven website. His host has just updated his server to PHP5 and the site has fallen over. It has no error messages just loads a blank white page with just the html head tags showing at the top of the page and ‘Done’ in the status bar.

I know nothing about PHP but have done some web stuff so had a look at his code and a bit of a Google around. From my findings online I have discovered if I remove the @ sign from these lines of code...

<?php @require_once "inc/header.inc";?>

…the site works fine (although it does have an ‘errors on page’ in the status bar?). From my reading I think the @ acts as something to do with suppressing error messages?

So my question is, if I get him to remove all the @ signs from those lines of code where require once is used and get the site back up, am I causing problems elsewhere?

If anyone has any ideas that would be great. Many thanks :)
 
I am having a similar problem with include/require and the latest php5 update but haven't got round to fixing it yet, it's starting to sound like a common thing.

You are correct that the use of @ suppresses error messages, if the page isn't loading properly then I would try removing the @ so that errors from the included files are shown and can be fixed.

Hope this helps.
 
It's only a common thing on badly coded sites.

Putting the @ in front of an include doesn't just stop error reporting for the include statament (probably what was wanted in case the file is missing), but also turns off error reporting for the entire included file, and any included by that...not what you want.

PHP 5 has a couple of backwards incompatible changes so I would suggest turning off all supress error operator in includes/requires and actually spending the time to fix and notices/errors or warnings. Your friend will thank you when the host upgrades to PHP 6 in a few years and suddenly the use of globals and uninitiated variables will really be painful to fix.
 
Back
Top Bottom