![]() |
Using XDebug with CodeIgniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Using XDebug with CodeIgniter (/showthread.php?tid=5143) |
Using XDebug with CodeIgniter - El Forum - 01-08-2008 [eluser]Josamoto[/eluser] Hi all, it's me Mr.Absurd Questions again. ![]() I am using the Europa Eclipse IDE with PDT version which comes with XDebug. It's a nifty debugger to use for PHP with step by step debugging, breakpoints and the works. Very handy to have. I can't live without it. The debugger however starts your application with a URL that looks similar to the following: http://www.fingfong.net/doit?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=11998163298751 CI tells me I have illegal characters in my URL, and when I add the ?=& to the config.php file ($config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';), some regex is failing and spitting out an error. How can I get CI to ignore the section? Using XDebug with CodeIgniter - El Forum - 01-08-2008 [eluser]Neovive[/eluser] Here are some notes summarizing the process I utilized to get the Zend Debugger working with Eclipse PDT on WAMP server. It's pieced together from various sites and some postings in the CI forum. I haven't tried it in a few months. If it works, I will add it to the Wiki. The Zend Debugger is available for free and seems to integrate better with Eclipse PDT than XDebug. the process eventually worked, but it was hard to get much value out of the debugger, since CI routes everything through the front controller. Installing Eclipse PDT v1 with Zend Debugger on WAMP Server for Code Igniter 1) Download and install WAMP Server from http://www.wampserver.com/en/ 2) Download the Debugger Extension from Zend Downloads (http://downloads.zend.com/pdt/server-debugger/) You need to download the Debugger Extension packet for the appropriate operating system. Unpack the zipped packet and take the dll (or so) file which matches the PHP version you have currently running. E.g. for PHP 5.2.0 the correct file is ZendDebugger.dll inside 5_2_x_comp directory. 3) Unzip the proper ZendDebugger.dll and copy to C:\wamp\php\ext 4) Add the following lines to your php.ini file: zend_extension_ts=c:/wamp/php/ext/ZendDebugger.dll zend_debugger.allow_hosts=127.0.0.1,list.your.ip.addresses [add comma separated list of all applicable ip's for development server] zend_debugger.expose_remotely=always 5) Restart server and create a <?=phpinfo();?> script. You should see a "With Zend Debugger ....." under the Powered By Zend logo. 6) In CI update the application/config.php as follows: $config['enable_query_strings'] = TRUE; $config['permitted_uri_chars'] = ''; 7) In CI update the system/libraries/Router.php (as per http://ellislab.com/forums/viewthread/59944/) line 288 Code: function _get_uri_string() 8) Right-click on index.php file in Eclipse and choose "Debug as PHP Webpage" 9) Configure Debug Properties: (click on debug button and and select "Debug Dialog") Make sure "Zend" is set as the server debugger Set the URL to your homepage: (e.g. http://localhost/index.php) Advanced: "Debug All Pages" Leave "Break at first line" 10) Run through the debug once (it will give a 404 Not Found the first time), then open Firefox and launch your URL. This will automatically trigger the debugger in Eclipse and it should work from the browser. Use "Step Into" to watch CI work it's magic. References: 1) PDT Wiki: Installing the Zend Debugger http://www.thierryb.net/pdtwiki/index.php?title=Using_PDT_:_Installation_:_Installing_the_Zend_Debugger 2) CI: http://ellislab.com/forums/viewthread/59359/ http://ellislab.com/forums/viewthread/59944/ 3) PDT Wiki: Source level debugging and Zend Firefox Extension http://www.thierryb.net/pdtwiki/index.php?title=Using_PDT_:_User_Guide_:_PHP_Source_Level_Debugging Using XDebug with CodeIgniter - El Forum - 01-14-2008 [eluser]ginger_tosser[/eluser] Neovive, I'm completely new not only to CI but also PHP & server side stuff (I'm usually a plain vanilla client side HTML & JS, and not very good at either :down: ) I've installed xampp and eclipse/pdt rather than wamp but when I try to debug even a simple PHP script(non-CI) the code doesn't break (I've tried both Zend and XDebug). Is there anything special about wamp, as opposed to xampp, that helps this along? or am I just a useless noob that doesn't understand even half of what I've done, just followed instructions blindly? Using XDebug with CodeIgniter - El Forum - 01-14-2008 [eluser]Neovive[/eluser] mdale, Welcome to CI. Debugging in PHP is always a weird thing -- I have never found it very useful and haven't used it since switching to CI -- it's very hard to follow the code, since CI (and all other PHP frameworks) go back and forth between core framework classes and your custom code. You have to set your breakpoints very carefully. Regarding your questions, XAMPP and WAMP are essentially the same thing -- so I doubt that is the issue. I have never used XAMPP though. You can download WAMP at (http://www.wampserver.com/). Here are a few other things to try: 1) Make sure the Debugger DLL's are installed properly by checking phpinfo(). 2) Make sure to set a breakpoint in Eclipse prior to starting the debugger. 3) Make sure to use the "Step Into" button to run the code, so you can watch what happens. Overall, I would recommend using the the built-in CodeIgniter Profiler, which outputs most of the information needed to successfully debug. Adding a few random print_r statements seems to handle the rest. To use the CI Profiler, just add $this->output->enable_profiler(TRUE); to your controller. If you want to include Session information in the profiler output (which I find very useful), do the following: 1) Create a file "My Profiler.php" in the "application/libraries" folder. 2) Insert the following code: Code: <? Using XDebug with CodeIgniter - El Forum - 01-26-2009 [eluser]Unknown[/eluser] I found this guy, his blog. He created Firefox extension for creating xdebug sessions without url modification. It is very helpfull!! |