[thelist] PHP erros on..
Mark Groen
evolt at markgroen.com
Tue Jan 9 10:15:55 CST 2007
On Tuesday 09 January 2007 07:42, Tris wrote:
> I've just put a site I've built onto mybosses localhost...
> He ges LOADS of errors.. I don't..
>
> sooo, how can I turn on all errors, so tat I can ensure I can clean
> all the code to be super good!
>
> I've looked at PHP.ini and i've got it on as far as I can see.. i think...?
He is probably running a more recent version of Apache than what most hosting
companies are running, PHP 5 won't be available everywhere until later this
spring IMHO.
PHP 5 is a little more strict with variables and objects, and you probably
have a number of unset index or variable errors? Move those variables out
into a function instead of having them in-line of your actual
process/procedure.
To suppress errors inline, use the @ character:
http://ca.php.net/operators.errorcontrol
There are also ways of doing it with the htaccess file, but it is not reliable
once your site goes on a shared hosting environment. You could wrap your
whole procedure in a function too:
ob_start();
at the beginning and at the end:
ob_end_flush();
The best way to get rid of these errors is to make your code future compatible
so those errors don't need to be fixed. You will want to have a look at the
isset function too:
http://ca.php.net/manual/en/function.isset.php
Example, a form that's may or may not get a POST variable passed to it:
if(isset($_SESSION['myvariable'])) { // etc. }
--
cheers,
mark
More information about the thelist
mailing list