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.
displaying error messages
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
When you check the output of
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
Code: Select all
<?php
phpinfo();
?>Mac
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.
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.
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.
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.
<?= 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
see also: http://www.php.net/manual/en/configurat ... ge-options