not seeing all the errors in Apache

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

not seeing all the errors in Apache

Post by davidklonski »

Hello

I am using Apache Web server to test my PHP scripts.
For some reasons I don't see some error messages when I run scripts while my friend who has Xitami Web server does sees them.

How do I configure Apache to show me all the errors, warnings and so on (very important in developement time)?

thanks
Pozor
Forum Commoner
Posts: 74
Joined: Tue Mar 30, 2004 11:11 pm
Location: Switzerland

Post by Pozor »

Hello,

use

Code: Select all

<?php
error_reporting(E_ALL); 
?>
greez Pozor
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Edit your php.ini file to ensure that you have:

Code: Select all

display_errors = on
and

Code: Select all

error_reporting = E_ALL
Mac
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

Missing warning messages

Post by davidklonski »

Here is a sample code that I am testing:

Code: Select all

<?php 
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 'on');
?>

<html>
<?php setcookie("test", "value", time() + 1000); ?>
<body>
cookie sent Text
</body>
</html>
[/

Code: Select all

As you notice, there is a single space before the <html> tag and that should cause a warning (I am sending a cookie information AFTER the headers are already sent).
When I run this code in Zend Studio, I see the warning.  However, when I run it directly in IE, I don't see any warning or error!

What am I doing wrong?  It could be a problem in the php.ini configuration file?  I am setting error-handling-values in my script.

Once I make those changes in php.ini, do I need to restart Apache and the changes will automatically take affect?

thanks
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

If you make the change in the php.ini restarting Apache should have it take effect. If you want to set the config variable in your code, maybe try:

Code: Select all

ini_set('display_errors', 1);
Mac
Post Reply