Link to home
Start Free TrialLog in
Avatar of userTester
userTesterFlag for United States of America

asked on

How to debug CodeIgniter (PHP)

Hi there,

How does one go about debugging in a CodeIgniter project? I have just started learning Codeigniter and PHP MVC.

I've setup Sublime with Xdebug, but can't seem to get it to step into my application. I am able to step through the very first index.php file, which is at the root, but even with a break point in my controllers/main.php controller file, it doesn't stop at that point.

Hope you can help!

Thanks!
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

No points for this because it's not an answer, but why choose something antiquated like CodeIgniter in 2015, when Laravel exists?  It's really worth considering.
http://www.sitepoint.com/best-php-framework-2015-sitepoint-survey-results/

As far as stepping through code and breakpoints, we don't really do that any more.  XDebug can be a useful tool, but a lot of the heavy lifting of app development is done with tools like PHPStorm.  It understands PHP and object-oriented design well enough that it can automate almost all of the drudgery of programming.  Give it a try and you'll never go back to the old ways!
Avatar of girionis
I've setup Sublime with Xdebug, but can't seem to get it to step into my application. I am able to step through the very first index.php file, which is at the root, but even with a break point in my controllers/main.php controller file, it doesn't stop at that point.

If you can step through the very first index.php file but not stop in the next break point it means that your debugger works fine, but your code fails before reaching the break point. Can you not go step by step from the first line until you see where it fails?
Avatar of userTester

ASKER

Ray Paseur,

Thanks for your reply, I'll definitely give Laravel and PHPStorm a try, but right now I am getting to know PHP MVC using CodeIgniter, because it's an easy install, and Laravel is still fairly new, also, getting to know CodeIgniter can't really hurt, but can only help with projects that use it.

What do you mean by:
As far as stepping through code and breakpoints, we don't really do that any more.
girionis,

Yes, I could not get it to stop at the breakpoints in my custom files, but I managed to set Netbeans 8.02, and can step into each page, including my custom pages.
@userTester, glad you got it working. So it was a problem with the actual setup of Xdebug then.
ASKER CERTIFIED SOLUTION
Avatar of userTester
userTester
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Using Netbeans worked without a problem.