hisoka Posted March 29, 2016 Share Posted March 29, 2016 Like firebug console is a debugger for JavaScript , is there a simple debugger for PHP that shows the errors I make in a PHP code ? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 29, 2016 Share Posted March 29, 2016 There are modules that you can use to integrate debugging with your IDE. For example, you can install and configure XDebug and connect it with an IDE like PHPStorm to allow you to trace code in PHPStorm when it runs on the server. Link to comment Share on other sites More sharing options...
hisoka Posted March 30, 2016 Author Share Posted March 30, 2016 I downloaded only xdebug module which is non thread safe and whose name is php_xdebug-2.1.2-5.2-vc6 . My php is vc6 version 5.2 and apache is 2.2 . I tried to configure xdebug in my php.ini file like this : zend_extension="C:\Program Files\PHP\php_xdebug-2.1.2-5.2-vc6.dll" save then restarted Apache , looked my php info but I could not see xdebug module . any help ? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 30, 2016 Share Posted March 30, 2016 Make sure php.ini is set to report all errors, including startup errors, and to use an error log. Check the error log for messages why it couldn't load the extension. Link to comment Share on other sites More sharing options...
hisoka Posted March 31, 2016 Author Share Posted March 31, 2016 (edited) "Check the error log for messages why it couldn't load the extension" display_errors = On //uncommentedlog_errors = On //uncommenteddisplay_startup_errors = On //uncommentederror_reporting = E_ALL //uncommented There is no error in the error log concerning why the module could not be load And now ???!! Edited March 31, 2016 by hisoka Link to comment Share on other sites More sharing options...
justsomeguy Posted March 31, 2016 Share Posted March 31, 2016 I would suggest starting here: https://xdebug.org/wizard.php I'm not watching you, so I don't know if you skipped a step or something. Go through the installation instructions and make sure you follow each step. Link to comment Share on other sites More sharing options...
hisoka Posted April 1, 2016 Author Share Posted April 1, 2016 hello Justsomeguy . I followed the link and it asked me to submit to a form and I did so . This is what I got as a result : Tailored Installation InstructionsSummaryXdebug installed: noServer API: Command Line InterfaceWindows: yes - Compiler: MS VC9 - Architecture: x86Zend Server: noPHP Version: 5.2.9-2Zend API nr: 220060519PHP API nr: 20060613Debug Build: noThread Safe Build: yesConfiguration File Path: C:\WINDOWSConfiguration File: C:\Program Files\PHP\php.iniExtensions directory: C:\Program Files\PHP\extPHP versions below 5.4 are not supported So , based on these information , what should I do now ?? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 1, 2016 Share Posted April 1, 2016 Well, if you want to use XDebug then get a newer version of PHP. That's up to you, that should be fairly obvious from that message. If you want to use XDebug then upgrade. 1 Link to comment Share on other sites More sharing options...
hisoka Posted April 2, 2016 Author Share Posted April 2, 2016 (edited) Problem solved thanks to you justsomeguy . Xdebug is working and showing errors and it is shown in the php info . But the errors Xdebug shows do not reflect the real errors made in the code . For example I tried with this little php code : <?php ech "well" ; ?> The error xDebug shew is : ( ! ) Parse error: syntax error, unexpected '"good"' (T_CONSTANT_ENCAPSED_STRING) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\a.php on line 3 When I see an error like that , I will never figure out that the error is in "ech" which should be "echo" . Plus the content of the error itself that XDebug gives is somehow unclear for a newbie like me which make the ability to understand the error and then correct it very difficult especially with expressions like T_CONSTANT_ENCAPSED_STRING or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) ( in an other error context ) So I said may be it is good idea to implement an IDE with xdebug like DEV PHP so that , may be through an IDE , errors become more obvious to understand and avoid . What do you think justsomeguy ? Edited April 2, 2016 by hisoka Link to comment Share on other sites More sharing options...
justsomeguy Posted April 4, 2016 Share Posted April 4, 2016 XDebug can integrate with several IDEs, such as PHPStorm. If you're asking for error messages that specifically say what you did wrong, PHP doesn't know what you did wrong. It doesn't know that you meant to write "echo". All it sees is a constant followed by a string. That error message doesn't match the line of code you wrote, but you should be able to see that and understand that it didn't expect the string and then figure out why. The first thing you should check in that case is to look at what is right before the string. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now