After setting up XDebug I succeeded in debugging php files with PHPStorm that are directly accessible.
But recently I started working with CodeIgniter and I worked through this tutorial. Now I was wondering if it was possible to debug specific MVC files, controller.php for example. Because after setting a breakpoint and starting to debug the controller file with PHPStorm it of course stated 'No direct script access allowed' since I directly accessed the script.
And when accessing the file manually e.g. http://localhost:63342/01_codeigniter_tutorial/public_html/index.php/controller it just shows a 404 page instead of the usual output shown when not opening it with PHPStorm.
So I'm wondering is there a specific documentation to read through for debugging CodeIgniter or am I just handling it wrong?
When Xdebug is running, it will call back to your IDE (like PhpStorm or VS Code) from the server where it's running. Your IDE will sit and listen for that connection on a specific port (typically port 9000 or 9003).
Thanks to LazyOne, who enlightened me in the comments I was able to find my mistakes and the solution.
The very first reason why a 404 page was shown when browsing the site with PhpStorm, was that I was using PhpStorm's built in web server and not my Apache. And said server doesn't handle mod_rewrite rules (which simplifies URLs) so for sites using CodeIgniter it won't work. And since the scripts aren't directly accesible it's not possible by simply clicking run in PhpStorm. So we have to initiate the debug request from the outside/web browser.
Now 2 things have to be done:
After everything has been set up, you only need to refresh your page and the IDE should receive your debugging request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With