Jump to content

how can I get PHP displays parsing error and line number


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".

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.