Search code examples
phplint

Why doesn't lint tell me the line number and nature of the parse error?


I'm calling php lint from a Windows batch file, like so:

@echo off
for %%f in (*.php) do php -l %%f

When a file contains a syntax error, it only outputs Errors parsing xxx.php. Is there any way to get it to tell me what the nature of the error is, and what line it's on? Maybe another switch?


Solution

  • I've accepted Charles's answer, but thought I should add a couple of details, as I had to do some extra hunting to find out what to do.

    The problem was that I wasn't seeing the stderr output, so I started by adding 2>&1 to the end of the relevant commands. This still didn't help, so I realised that the problem was that PHP wasn't outputting stderr stuff at all. I went to the PHP install directory and looked in php.ini and found that by default, display_errors is Off. Changed it to On and it now works.