简体   繁体   English

NetBeans中的CakePHP调试

[英]CakePHP debugging in NetBeans

I'm developing a CakePHP project and i need to debug the project with Netbeans debug tools. 我正在开发一个CakePHP项目,我需要使用Netbeans调试工具调试项目。 I have used this post to configure debugging but it does not work. 我使用这篇文章来配置调试,但它不起作用。 Break points are not hit. 断点没有被击中。

php.ini php.ini中

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=8080
xdebug.remote_log="/var/log/xdebug/xdebug.log"

xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "D:/wamp/tmp"
xdebug.show_local_vars=0

Project Location 项目位置

D:\wamp\www\MoDACA

PHP Debugging Options (in Tools > Options ) PHP调试选项 (在工具>选项中)

Debugger Port: 8080
Session ID: netbeans-xdebug
Max Data Length : 2048
Stop at First Line : True

NetBeans Run Configuration NetBeans运行配置

Project URL: http://localhost:8080/MoDACA/
Index File: index.php

Advanced Settings 高级设置

Debug URL : Ask Everytime
Debugger Proxy
Host: empty Port: 9001
Warning - Path Mapping might be needed.

The project is set as the Main Project. 该项目被设置为主项目。 I set the break point in the StudentsController in function editStudent . 我在函数editStudent中的StudentsController中设置了断点。 When i clicki debug i set the specific URL as 当我点击调试时,我将特定的URL设置为

http://localhost:8080/MoDACA/students/editStudent/1

I have done the above configuration but when i set the break point in side the editStudent function it is not hit. 我已经完成了上面的配置,但是当我在editStudent函数中设置断点时,它没有被命中。 Can someone please help? 有人可以帮忙吗?

Make sure you have selected Web Root folder in the project properties. 确保在项目属性中选择了Web Root文件夹。

In the Projects panel right click your project, then select Properties, then on the Sources tab on the left select your Web Root folder by clicking "Browse" beside it. 在“项目”面板中右键单击项目,然后选择“属性”,然后在左侧的“源”选项卡上单击旁边的“浏览”选择Web Root文件夹。 By default it should be app/webroot 默认情况下,它应该是app/webroot

Add Path Mapping in Project properties -> Run Configuration -> Advanced. 在项目属性中添加路径映射 - >运行配置 - >高级。 Server Path is file system path on remote server, not web server path. Server Path是远程服务器上的文件系统路径,而不是Web服务器路径。 So, if your project is in C:/Projects/my_cake_php_project and on remote server it's in /var/www/mydomain.com your mappings should be: 因此,如果您的项目位于C:/ Projects / my_cake_php_project,而在远程服务器上,则位于/var/www/mydomain.com中,您的映射应为:

Server Path: /var/www/mydomain.com/
Project Path: C:/Projects/my_cake_php_project

At least it works for me ;-) Make sure that those paths are really saved On NetBeans 8.0.1 if you're still editing Server Path/Project Path and click 'OK' paths won't be saved. 至少它适用于我;-) 确保这些路径确实保存在NetBeans 8.0.1上如果您仍在编辑服务器路径/项目路径并单击“确定”路径将不会保存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM