Jump to content

how can I get PHP displays parsing error and line number


hvle

Recommended Posts

I know I got syntax error some where.  But php simply say "Errors parsing esearch.php".  It does not display line number or any kind of hint.  I've also set the error reporting to display all error and E_PARSE in ph.ini

 

I am using php 5.2 and command line to run.

 

Thanks

set error reporting to all:

 

error_reporting(E_ALL);

 

ensure display errors is on:

 

ini_set("display_errors", 1);

 

I think that you can also use __LINE__ to display the line in the php file.

 

http://us2.php.net/manual/en/language.constants.predefined.php

The thing that troubled me is the parsing error, not run-time error.  The error occurs when php see a php code that it doesn't like.

 

try to run a code like this

<?php
for ($i=1;$i<5; $i++)
{
  $i = 6
}
?>

 

Note there is no semicolon after 6.  When running this script, I got absolutely error message.

except for "parsing error".

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.