Page 1 of 1

errors not showing up in browser

Posted: Mon Jul 10, 2006 3:08 am
by zipo13
Hi,
I'm new to php and I've search this forum for this problem and the net but couldn't find anything useful.
I have php 5.1.4 and apache 2.2 installed on a linux fedora core 5 machine.
everything works fine except for errors not showing up in the browser.
I thought that php errors show up in the browser by default but I get nothing.
I created this file file.php

Code: Select all

<html>
<head>
<title> momo </title>
</head>
<body>
    this is my html page <br>
<?php 
    print_r('dodo');
    $x = 1;
    print x;
?>
</body>
</html>
Note that I have an html page that creats a var $x but prints x instead of $x.
when I call http://127.0.0.1/test.php from the browser I get:

Code: Select all

this is my html page
dodox
but when I execute it from the command line using: php file.php

Code: Select all

<html>
<head>
<title> momo </title>
</head>
<body>
this is my html page <br>
dodoPHP Notice:  Use of undefined constant x - assumed 'x' in /var/www/html/momo.php on line 10
x</body>
I looked in php.ini but couldn't find anything useful...
can anyone help?

Posted: Mon Jul 10, 2006 3:17 am
by Benjamin
Try..

Code: Select all

<html>
<head>
<title> momo </title>
</head>
<body>
    this is my html page <br>
<?php
    echo 'dodo';
    echo '<br />';
    $x = 1;
    echo $x;
?>
</body>
</html>
Besides that, on my test server, for php.ini, I have...
error_reporting = E_ALL|E_STRICT
display_errors = On
Your preferences may vary..

Posted: Mon Jul 10, 2006 4:14 am
by zipo13
Ok display_errors = On was the problem but its not solved yet.
I opened the php.ini file and noticed that display_errors was not there so I added it and restarted the server.
it didn't help.
So I rebooted the machine - still nothing.
So I created a phpInfo file and noticed that it says that display_errors = Off as the local value and the mater value.
in the same phpInfo appears
Configuration File (php.ini) Path /etc/php.ini

I made sure that in the /etc/php.ini file its marked as:
display_errors = On

so why does php revert to display_errors = Off?
Only when I add
ini_set('display_errors', 'On');
to the php script itself I can see the error.

Posted: Mon Jul 10, 2006 4:33 am
by zipo13
OK - found the problem.
I added the display_errors to the top of the file failing to notice that there was another display_errors way under it in the file.
Thank you for the help.