[英]Debugging Codeigniter with XDebug using PHPStorm
After setting up XDebug I succeeded in debugging php files with PHPStorm that are directly accessible. 设置XDebug后,我成功调试了可以直接访问PHPStorm的php文件。
But recently I started working with CodeIgniter and I worked through this tutorial . 但最近我开始使用CodeIgniter,我完成了本教程 。 Now I was wondering if it was possible to debug specific MVC files, controller.php for example.
现在我想知道是否可以调试特定的MVC文件,例如controller.php。 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.
因为在设置断点并开始使用PHPStorm调试控制器文件之后,它当然声明“不允许直接脚本访问”,因为我直接访问了脚本。
And when accessing the file manually eg 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. 当手动访问文件时,例如http:// localhost:63342 / 01_codeigniter_tutorial / public_html / index.php / controller它只显示404页面而不是显示的常用输出,而不是用PHPStorm打开它。
So I'm wondering is there a specific documentation to read through for debugging CodeIgniter or am I just handling it wrong? 所以我想知道是否有一个特定的文档来读取调试CodeIgniter或我只是处理错误?
Thanks to LazyOne, who enlightened me in the comments I was able to find my mistakes and the solution. 感谢LazyOne,他在评论中启发了我,我能够找到我的错误和解决方案。
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. 使用PhpStorm浏览网站时显示404页面的第一个原因是我使用的是PhpStorm内置的Web服务器,而不是我的Apache。 And said server doesn't handle mod_rewrite rules (which simplifies URLs) so for sites using CodeIgniter it won't work.
并且说服务器不处理mod_rewrite规则(这简化了URL),因此对于使用CodeIgniter的站点,它将无法工作。 And since the scripts aren't directly accesible it's not possible by simply clicking run in PhpStorm.
由于脚本不能直接访问,因此只需单击PhpStorm中的run即可实现。 So we have to initiate the debug request from the outside/web browser.
所以我们必须从外部/ Web浏览器启动调试请求。
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. 完成所有设置后,您只需刷新页面,IDE就会收到您的调试请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.