Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got a VPS using Suse Linux 10.3.

Apache 2 / PHP 5.2.6 was set up automatically.

When I look at this valid PHP file in a browser, it displays correctly:

<?php
echo 'this is test';
?>

However, when I look at this invalid PHP file, I expect it to show me an error, but it shows absolutely nothing, blank page, no source:

<?php
nnn 'this is test';
?>

Via phpinfo() I found that the "loaded php.ini configuration file" is at /etc/php5/apache2/php.ini and in that file I found this uncommented line:

error_reporting  =  E_ALL

which tells me that it should be showing all errors and warnings.

What else do I have to do so that PHP shows errors?

share|improve this question
    
Did you restarted apache ? –  cstamas Jun 28 '09 at 19:19
add comment

2 Answers

up vote 2 down vote accepted

Normally, web applications will log errors to the Apache error log. This is the file specified in the relevant ErrorLog setting for your server or virtual host section. PHP applications will send logs there, but they aren't entirely the most accessible or useful logs; your logging can get lost between other errors. PHP can be configured to log to a separate log file, but this is not very different from logging to the Apache error log. You can configure Apache to log errors to the browser using

display_errors = On

in your php.ini. With this, log lines will appear in your browser. You really should not use this option on a production system. If you need to mix production and development applications on the same system, you can use:

ini_set("display_errors","On");

at the top of your development php files.

The error_reporting option changes what PHP reports.

You can do better though. XDebug is a PHP extension which adds some very useful PHP development features, like stack traces, profiling and code coverage.

share|improve this answer
add comment
display_errors = On

?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.