Page 1 of 1
Displaying syntax errors
Posted: Mon Nov 21, 2005 10:04 am
by twigletmac
Since I can normally just edit the php.ini this hasn't come up for me before but, what can you do to make PHP show syntax errors if you can't?
Using ini_set('display_errors', true) only works if there aren't any major syntax errors according to the testing I've done. So, what workarounds are there?
Ta muchly,
Mac
Posted: Mon Nov 21, 2005 10:30 am
by Buddha443556
Might need this too:
Or maybe E_STRICT for PHP5.
Posted: Mon Nov 21, 2005 10:32 am
by Jenk
If you are refering to parse errors, there is nowt you can do without access to php.ini.
Posted: Mon Nov 21, 2005 10:36 am
by Maugrim_The_Reaper
/me wonders if a backtrace can be echoed purposefully even if error_dispay is disabled? Maybe from within an error handler you cooked up? Before the script terminates?
Posted: Mon Nov 21, 2005 10:47 am
by Jenk
If there are parse errors, you won't even be able to get that far

Posted: Mon Nov 21, 2005 10:53 am
by pickle
It sounds to me like you just want to see if a page has correct syntax. Why not just run the file?
However, that seems like much too simplistic a solution, so I must be missing something. You can call a shell command to give you errors:
Code: Select all
echo shell_exec('php -l /path/to/somefile.php');
That should give you any parse errors.