Page 1 of 1

displaying error messages

Posted: Fri Sep 26, 2003 2:48 am
by zitpig
Hello all,
I'm new to php, and am excited about learning it.
I've got php4 installed on win98, and am using pws 4.
I understand php3 came with a debugger, but php4 has none.
Is there any way to get error messages displayed in the browser. I've got 'display_errors = On' and 'error_reporting = E_ALL' ... (not exactly sure what these mean). Currently, if there's an error in my code, the browser shows a blank. I've discovered using the DOS window and calling php.exe with the php file name to see some errors, but I can't believe this is the best way to do it.

Any sugestions appreciated,
Zitpig.

Posted: Fri Sep 26, 2003 4:57 am
by JayBird
can you copy and paste that section of your PHP.ini.

What you have described should work.

Mark

Posted: Fri Sep 26, 2003 6:38 am
by twigletmac
When you check the output of

Code: Select all

<?php
phpinfo();
?>
What does it say about display_errors and error_reporting? Occasionally people find that they have possibly edited the wrong php.ini and thus the changes they make don't take effect.

Mac

Posted: Fri Sep 26, 2003 9:52 pm
by zitpig
Mark and Mac,

I did a phpinfo() and it just reflected my ini file, but I also got error messages in the browser. The only different thing I'd done was restarting the computer. I thought that every time php starts it reads the ini file, but it must read it once a session(?)....does php have sessions? Anyway, I now know to reboot whenever I change the ini file.
I also found display_startup_errors = Off and changed it to on, but I'm not sure what this does.

Thanks.

Posted: Sat Sep 27, 2003 7:11 am
by JAM
You dont need to reboot the computer per se, but the webserver. Check it's documents on how to do that.

To continue, posting some of the error msg's would help, and if those refers to a specific line somewhere, that line of code would be helpful also.

Posted: Mon Sep 29, 2003 2:00 am
by zitpig
Stopping and restarting the server...of course.
Doesn't seem to be the case with PWS though, unless I'm just not waiting long enough before restarting. (I couldn't find anything in the php help that says how long sessions hang around for before they die. With ASP on PWS, session variables can stay viable for minutes after the browser has been closed).
I was just interested in getting error messages printed to the browser window, and that seems to be happening now.

An eg of the this...

<?php
$name = "peter" ?>
The value in the variable <i>name</i> is <?php= $name ?>.

Causes this output into the browser...

Parse error: parse error, unexpected '=' in D:\_work1\php\php4.php on line 3

I discovered that this is fixed by using the short form of the delimiter...

<?=$name ?>

rather than the longer form ...

<?php=$name ?>

Cheers.

Posted: Mon Sep 29, 2003 2:07 am
by volka
<?= expression ?> is the same as <?php echo expression ?> if short_tags are enabled. There is no tag <?php= ?>

see also: http://www.php.net/manual/en/configurat ... ge-options

Posted: Mon Sep 29, 2003 4:17 am
by JAM
If you have issues with sessions, you can try to delete them. You state the whereabouts in the php.ini.