Sometimes, your head turns trying to figure out what the problem is with your script. many times when the display_errors if off, you won't have a clue as to what the problem is unless you display the php errors.
this is how the php.ini file would look like:
Quote:
; - display_errors = Off [Security]
; With this directive set to off, errors that occur during the execution of
; scripts will no longer be displayed as a part of the script output, and thus,
; will no longer be exposed to remote users. With some errors, the error message
; content may expose information about your script, web server, or database
; server that may be exploitable for hacking. Production sites should have this
; directive set to off.
; Print out errors (as a part of the output). For production web sites,
; you're strongly encouraged to turn this feature off, and use error logging
; instead (see below). Keeping display_errors enabled on a production web site
; may reveal security information to end users, such as file paths on your Web
; server, your database schema or other information.
display_errors = On
As you have read from the php.ini file above, having the display_errors on could have a security issue. so many web hosting companies turn it off, this is to protect your website from harm.
One way to display erorrs while the display_errors is off in the php.ini file, is to create write these functions at the beginning of your script files (.php files)
copy and paste this code
Code:
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);
As for me, i had to learn the hard way. i was installing a gallery into my site and could not figure out what the problem was. this is what the gallery site had to say:
When diagnosing a problem, you want to be sure that you notice all hints that there might be. That's why you need to ensure that PHP is configured to display and log errors in such cases.
* Starting with Gallery 2.2, it suffices to put Gallery into its debug mode.
* In Gallery 2.0 and Gallery 2.1 (including 2.1.2), the debug mode doesn't enable displaying PHP errors yet. You'll need to enable it yourself.
* In rare cases, you also have to ensure that PHP errors are not just displayed, but also logged.
Also see: * How can I view the error log of the webserver?
By browsing to your Gallery's phpinfo page at http://www.example.com/gallery/lib/support/index.php -> PHPinfo, you can find all the configuration details of PHP we're interested in. And these are:
* display_errors (we want it to be On or 1)
* display_startup_errors (we want it to be On or 1)
* log_errors (we want it to be On or 1)
* error_log (it should be anything but undefined)
* error_reporting (it should be 2047 or larger)
You can ask your webhost to help you to put PHP into a configuration that is useful for debugging. Or you can open Gallery's main.php file in a text editor and replace:

