[Scottish] PHP configuration problem ?

Paul Millar scottish at mailman.lug.org.uk
Mon Nov 11 22:38:01 2002


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
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --