[Scottish] PHP configuration problem ?

george scottish at mailman.lug.org.uk
Mon Nov 11 22:12:01 2002


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.

George


At 22:04 11/11/2002 +0000, you wrote:

>Cutting the code down a bit (just to make the problem obvious) ...
>
>On Mon, 11 Nov 2002, Tom Shearer wrote:
>[...]
> >       $fp = fopen($targetfile, "a+");
> >       if (!$fp)
> >               { echo "<strong>Your ...";
> >                 echo    "It's the ... ";}
> >                       exit;
>[...]
>
> > Any idea where I'm going wrong ?
>
>Look where the if() clause finished, then "}" is after the echo, but
>before the exit;
>
>So the code terminates immediately after opening the file.
>
>Also, you might want to use "@fopen" rather than "fopen".  The "@"
>stops PHP from generating any error-HTML.
>
>HTH
>
>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