..oO(Jeff)
>Jerry Stuckle wrote:
>>
As Micha said - it needs to be in your php.ini file (or .htaccess), NOT
IN YOUR SCRIPT.
Hmm, this seems awkward to me as wouldn't it then turn on error
reporting in all scripts?
Correct. On a development machine that's how it's supposed to be. Of
course on a production servers errors should never be shown, but written
to a logfile instead, because they might contain sensitive informations
which you surely don't want to see in the hands of a malicious user.
>Or should I just set: display_startup_errors
to true in php.ini?
Enable all errors and set error_reporting to its highest level.
I haven't dug out php.ini yet, I see there seems to be two copies
somewhere off /etc, I believe. One is a backup?
Check phpinfo() which ini file is in use.
It might also depend on which PHP version you installed and on which
platform. By default the installer comes with multiple different ini
files (three IIRC), but if for example you compile your own PHP from the
sources, you might end up with another ini file in a totally different
location (this happens here on my Debian/Linux box for example).
>How does the .htaccess bit work?
If PHP is installed as a server module, you can use some directives in
an .htaccess file to control various PHP settings. See the manual for
details.
http://www.php.net/manual/en/configuration.changes.php
>When you have a syntax error, NOTHING in the script - including the
ini_set(), is executed.
Well, I believe I accidentally found a way around this without knowing
what I was doing:
<?php
ini_set('display_startup_errors','1');
include 'script_to_test.php';
?>
This works indeed, because the first script is parsed and executed
correctly. The parse error happens in the include file, which will then
kill the interpreter.
>I tend to keep my core code in a separate file anyways and the calling
page is just a shell with a few customizations. That's my style
anyways...
With some more testing scenarios and stricter rules this would be called
a "unit test".
Micha