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
Displaying syntax errors
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
Might need this too:
Or maybe E_STRICT for PHP5.
Code: Select all
error_reporting(E_ALL);- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
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:
That should give you any parse errors.
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');Real programmers don't comment their code. If it was hard to write, it should be hard to understand.