[Scottish] PHP configuration problem ?

george scottish at mailman.lug.org.uk
Mon Nov 11 23:09:00 2002


  Paul,
            My mistake, I couldn't remember the number, and had meant to 
check it before sending the e-mail. I always use the constant E_ALL so 
error_reporting(E_ALL) would set it to the highest level, but then I know 
which version of PHP my testing /deployment server is running so I don't 
need to worry about compatibility.  I have just checked the PHP site and to 
set error_reporting to the highest level you would use 
error_reporting(2047); according to the online manual error_reporting(63) 
will have the same effect in PHP3.


error_reporting() is a handy function, and having the error reporting set 
to E_ALL promotes better coding.


George


At 22:37 11/11/2002 +0000, you wrote:
>Hi George,
>
>On Mon, 11 Nov 2002, george wrote:
> > Paul the main reason the script failed was because Tom had supplied the
> > wrong parameters in the fwrite() and fclose() functions. Of course the 
> fact
> > exit; was outwith the conditional block was another issue. The fact 
> that no
> > error messages were generated suggests that the error reporting levels 
> have
> > been set incorrectly. When developing scripts it's an idea to set the 
> error
> > reporting level to it's highest, you can do this within the php.ini 
> file or
> > you can use the error_reporting() function   for example 
> error_reporting(1)
> > would set it to the highest level.
>
>Hmmm I'd say the "main reason" is the mis-placed break. To be honest, I
>did miss that the fwrite() and fclose() were wrong too. But, if only the
>break is fixed, PHP says:
>
>   Warning: Supplied argument is not a valid File-Handle resource in
>            /home/paulm/public_html/test1.php on line 15
>   Warning: Supplied argument is not a valid File-Handle resource in
>            /home/paulm/public_html/test1.php on line 16
>
>   [lines 15 & 16 are fwrite() and fclose() in my copy of the script]
>
>which is fairly explicit, I'd say ;^)
>
>So, fixing the "break" would cause the other bugs to leap out.
>
>I've not done anything _too_ esoteric in PHP, but I've found the standard
>error-reporting to be fine.  Looking at it again now, I've been using the
>"standard"  RedHat RPMs. They set the error reporting to "E_ALL &
>~E_NOTICE" (ie everything except normal notice messages)
>
>I didn't know about the error_reporting() function. It looks a handy way
>of bumping up the verbosity of PHP without mucking about with the config
>file. I'll definitely be using it in the future ...
>
>BTW, the docs say E_ALL (currently 2047) is the maximum error level. Did
>you mean "error_reporting(-1)"?
>
>Cheers,
>
>Paul.
>
>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>Particle Physics (Theory & Experimental) Groups                   Paul Millar
>Department of Physics and Astronomy                     paulm@astro.gla.ac.uk
>University of Glasgow                                 paulm@physics.gla.ac.uk
>Glasgow, G12 8QQ, Scotland             http://www.astro.gla.ac.uk/users/paulm
>+44 (0)141 330 4717        A54C A9FC 6A77 1664 2E4E  90E3 FFD2 704B BF0F 03E9
>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>
>
>_______________________________________________
>Scottish mailing list
>Scottish@mailman.lug.org.uk
>http://mailman.lug.org.uk/mailman/listinfo/scottish