hvle Posted August 14, 2007 Share Posted August 14, 2007 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 Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/ Share on other sites More sharing options...
uwannadonkey Posted August 14, 2007 Share Posted August 14, 2007 post the code? have u tried a debugger? Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323063 Share on other sites More sharing options...
hvle Posted August 14, 2007 Author Share Posted August 14, 2007 well I found the syntax, but that's not problem. I need php to display the line number that has the parsing error to make debugging quicker. Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323068 Share on other sites More sharing options...
uwannadonkey Posted August 14, 2007 Share Posted August 14, 2007 have u tried a debugger? Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323069 Share on other sites More sharing options...
hvle Posted August 14, 2007 Author Share Posted August 14, 2007 have u tried a debugger? I don't aware there is one. How do I get one? Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323074 Share on other sites More sharing options...
uwannadonkey Posted August 14, 2007 Share Posted August 14, 2007 google is ur best friend, mate! <a href=http://www.google.com/search?hl=en&q=php+debugger&btnG=Search>Google Search Link(click here, i searched for you!)</a> Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323075 Share on other sites More sharing options...
hvle Posted August 14, 2007 Author Share Posted August 14, 2007 thanks Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323085 Share on other sites More sharing options...
uwannadonkey Posted August 14, 2007 Share Posted August 14, 2007 marks us solved! *Click solved button!* have a nice day! Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323087 Share on other sites More sharing options...
hvle Posted August 14, 2007 Author Share Posted August 14, 2007 um.. its not solved. Debugger doesn't work! Still looking for a configuration in PHP that display parsing error information Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323133 Share on other sites More sharing options...
uwannadonkey Posted August 14, 2007 Share Posted August 14, 2007 did u link your debugger to your php path? Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323136 Share on other sites More sharing options...
hvle Posted August 14, 2007 Author Share Posted August 14, 2007 I loaded the debugger as php module in php.ini Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323139 Share on other sites More sharing options...
hitman6003 Posted August 14, 2007 Share Posted August 14, 2007 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 Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323145 Share on other sites More sharing options...
hvle Posted August 14, 2007 Author Share Posted August 14, 2007 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". Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323152 Share on other sites More sharing options...
dbo Posted August 14, 2007 Share Posted August 14, 2007 Did you follow hitmans suggestion? Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323155 Share on other sites More sharing options...
hvle Posted August 14, 2007 Author Share Posted August 14, 2007 yes I did, This is the code: <?php ini_set("display_errors", 1); error_reporting(8191); echo "alskdjfalskdfj"; for ($i=1;$i<5; $i++) { $i = 5 } ?> Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323159 Share on other sites More sharing options...
dbo Posted August 14, 2007 Share Posted August 14, 2007 That's some good looking code! What output is it producing now? Is there anyway you can slap it on Apache and let us point a browser at it and see what it says? Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323160 Share on other sites More sharing options...
hvle Posted August 14, 2007 Author Share Posted August 14, 2007 That's just a test code that should produce some parsing error. The command line out put when I ran that code: in Unknown on line 0 Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323162 Share on other sites More sharing options...
dbo Posted August 14, 2007 Share Posted August 14, 2007 Oh I agree it should produce an error. Interestingly enough I've never used PHP as just a scripting language from the command line. I've only used it for web stuff. In theory I guess it should be the same. Hrmmm. Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323165 Share on other sites More sharing options...
dbo Posted August 14, 2007 Share Posted August 14, 2007 Yeah I dunno. Logically that should work according to the manual http://us3.php.net/error_reporting Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323168 Share on other sites More sharing options...
hvle Posted August 14, 2007 Author Share Posted August 14, 2007 imagine you got that error somewhere in a 4,000 line of code script. It won't be pretty. Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323170 Share on other sites More sharing options...
dbo Posted August 14, 2007 Share Posted August 14, 2007 Absolutely agree. Link to comment https://forums.phpfreaks.com/topic/64766-how-can-i-get-php-displays-parsing-error-and-line-number/#findComment-323171 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.