php 使用 Aptana Studio 3 进行 XDebug
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6860814/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
XDebug with Aptana Studio 3
提问by OTN
I would like to know how i can get XDebug work with Aptana Studio 3 (I already have Aptana Studio 3 on this machine with XAMPP).
我想知道如何让 XDebug 与 Aptana Studio 3 一起工作(我已经在这台带有 XAMPP 的机器上安装了 Aptana Studio 3)。
Do you know a recent article telling me how to do this and explains XDebug? I have no experience nor any knowledge about XDebug, i looked for articles but all seem outdated to me.
你知道最近的一篇文章告诉我如何做到这一点并解释 XDebug 吗?我对 XDebug 既没有经验也没有任何知识,我找了一些文章,但对我来说似乎都过时了。
回答by Andy Braham
I realize that this is a old thread but I also had a difficult time finding out how to debug php with Aptana Studio and FireFox so here is a quick how-to to get it working...
我意识到这是一个旧线程,但我也很难找到如何使用 Aptana Studio 和 FireFox 调试 php 所以这里有一个快速的方法来让它工作......
The easiest way I found is to install wamp server V2.2, this is a very useful program as it installs Apache Server, PHP and MySQL and other tools, everything can be easily configured via the taskbar.
我找到的最简单的方法是安装 wamp server V2.2,这是一个非常有用的程序,因为它安装了 Apache Server、PHP 和 MySQL 等工具,一切都可以通过任务栏轻松配置。
1.) Install Aptana Studio V3.3.Xor higher Download here
1.) 安装 Aptana Studio V3.3.X或更高版本在这里下载
2.) Install WampServer V2.2 or higher Download here(XAMMP users read bottom).
2.) 安装 WampServer V2.2 或更高版本在此处下载(XAMMP 用户阅读底部)。
WampServer:
Wamp服务器:
1.) Make sure XDebug is accepting remote debug, click on the WampServer icon in the taskbar and go to PHP->PHP Setting and make sure that "(XDebug): Remote debug" is checked if not select it click on the WampServer icon and "Restart all services".
1.) 确保 XDebug 正在接受远程调试,单击任务栏中的 WampServer 图标,然后转到 PHP->PHP 设置,并确保选中“(XDebug): Remote debug”,如果未选中,请单击 WampServer 图标和“重新启动所有服务”。
2.) Verify that XDebug is running: a.) If you had WampServer insert index.php enter "localhost" in the URL and under "Tools" click "phpinfo()" and check to make sure XDebug is running, you should see the following in FireFox:
2.) 验证 XDebug 是否正在运行: a.) 如果您让 WampServer 插入 index.php 在 URL 中输入“localhost”并在“工具”下单击“phpinfo()”并检查以确保 XDebug 正在运行,您应该看到FireFox 中的以下内容:
b.) If you didn't overwrite the index.php create a file (/www_dir/phpinfo.php) with the following:
<?php
phpinfo();
?>
b.1) In FireFox enter "localhost/phpinfo.php" and look for XDebug as shown in the previous image.
Aptana Studio:
阿普塔纳工作室:
1.) Click Window->Preferences
2.) In the Preferences dialog go to Aptana Studio->Editors->PHP->PHP Interpreters
3.) Click "Add..."
4.) Enter the information like
5.) Click "OK"
6.) Click on the debug icon and select "Debug Configurations"
7.) Double click on "PHP Web Page"
8.) Click the plus next to "PHP Server"
a.) Enter a name
b.) Base URL will be "localhost"
c.) Document Root will be the path to your index.php
Finally in Aptana Studio click the Debug Icon Arrow and select the configuration you named above. If Firefox prompts you install the Aptana Studio plugin...
最后在 Aptana Studio 中单击 Debug Icon Arrow 并选择您在上面命名的配置。如果 Firefox 提示您安装 Aptana Studio 插件...
Hope this helps out...
希望这有助于...
-------------
-------------
XAMPP USERS
XAMPP 用户
-------------
-------------
Follow the steps provided but your directory link in the
按照提供的步骤操作,但您的目录链接在
In the Preferences dialog go to Aptana Studio->Editors->PHP->PHP Interpreters
在 Preferences 对话框中,转到 Aptana Studio->Editors->PHP->PHP Interpreters
should link to C:\xampp\php\php.exe and C:\xampp\php\php.ini respectively
应该分别链接到 C:\xampp\php\php.exe 和 C:\xampp\php\php.ini
***** UPDATE *****
***** 更新 *****
If you are using Firefox V20+ there are some compatibility problems with Firebug V1.8+ that basicly breaks Firefox's context menus, I could not find a fix for it so I ended up having to go another route and figured I should make a post, Aptana Studio is based on Eclipse so the best way IMHO to get PHP Debugging is to install Eclipse with PDT and remove Aptana Studio... The above instructions will work to get everything working with XDebug
如果您使用的是 Firefox V20+,则 Firebug V1.8+ 存在一些兼容性问题,这基本上会破坏 Firefox 的上下文菜单,我找不到解决方法,所以我最终不得不走另一条路,并认为我应该发个帖子,Aptana Studio 基于 Eclipse,所以恕我直言,获得 PHP 调试的最佳方法是使用 PDT 安装 Eclipse 并删除 Aptana Studio...上述说明将有助于使所有内容与 XDebug 一起使用
Here is a nice link on how to get everything up and running eclipse-pdt
这是一个关于如何启动和运行eclipse-pdt的很好的链接
回答by sgibly
At the moment, there is no PHP debugger support in Aptana Studio 3. However, there will be soon. See: http://jira.appcelerator.org/browse/APSTUD-769and add yourself as a watcher to get informed when it's done.
目前,Aptana Studio 3 中没有 PHP 调试器支持。但是,很快就会有。请参阅:http: //jira.appcelerator.org/browse/APSTUD-769并将您自己添加为观察者以在完成时获得通知。
For now, you can install PDT from eclipse.org if you really need to debug. They also provide up-to-date docs on how to use it. There is a small learning curve, but it will work pretty much the same in Aptana (once it's released), so you have nothing to lose :)
现在,如果您确实需要调试,可以从 eclipse.org 安装 PDT。他们还提供有关如何使用它的最新文档。有一个小的学习曲线,但它在 Aptana 中的工作几乎相同(一旦发布),所以你没有什么可失去的 :)
回答by mutil
Here is a mini how-to configure and start using XDebug with Aptana Studio 3.3, assuming you have installed xdebug on your system. (In Ubuntu/Linux it's just a sudo apt-get install php5-xdebug
).
这是一个小型的如何配置和开始在 Aptana Studio 3.3 中使用 XDebug,假设您已经在您的系统上安装了 xdebug。(在 Ubuntu/Linux 中它只是一个sudo apt-get install php5-xdebug
)。
Configure the debugger
配置调试器
In preferences->Aptana Studio->PHP->PHP Interpreter click on Add..., and specify a name, the php executable(/usr/bin/php in most Linux distributions), the php.ini(/etc/php5/conf.d/20-xdebug.ini on my system), and leave XDebug in the select field of PHP debugger.
在首选项->Aptana Studio->PHP->PHP Interpreter 单击 Add...,并指定一个名称,php 可执行文件(在大多数 Linux 发行版中为 /usr/bin/php),php.ini(/etc/php5 /conf.d/20-xdebug.ini 在我的系统上),并将 XDebug 留在 PHP 调试器的选择字段中。
Using the debugger
使用调试器
Make a php file and put some code in it:
制作一个php文件并在其中放入一些代码:
<?php
$defined_var = 'some value';
echo $defined_var;
echo $undefined_var;
exit();
?>
Save it and press Run->Debug As->PHP Script and you will be prompted to switch Workspace.
保存并按 Run->Debug As->PHP Script,系统会提示您切换 Workspace。
Specify a Line Breakpoint by double clicking next to a line number, for example at the line of exit() function.
Press Resume(F8) and you can see that the Debug Current Instruction Pointer moved there.
At the variables tab, you should now see which variables have some value or they are uninitialized. The output can be found at the console tab.
通过双击行号旁边(例如在 exit() 函数的行处)来指定行断点。按 Resume(F8),您可以看到 Debug Current Instruction Pointer 移到了那里。
在变量选项卡上,您现在应该看到哪些变量具有某些值或未初始化。输出可以在控制台选项卡中找到。
Pressing resume again will terminate the debug.
再次按恢复将终止调试。
Of course, this is only the tip of the iceberg regarding debug, but it's a start.
There are many other options to explore and ways to debug your scripts.
当然,这只是调试的冰山一角,但这是一个开始。
还有许多其他选项可供探索和调试脚本的方法。
回答by Mainul
I have use Aptana Studio 3.2.2 to develop my Drupal site and use XDebug to debug the project. The Aptana Studio supports xdebug. You need to follow some steps to enable xdebug in Aptana Studio.
我使用 Aptana Studio 3.2.2 开发我的 Drupal 站点并使用 XDebug 调试项目。Aptana Studio 支持 xdebug。您需要按照一些步骤在 Aptana Studio 中启用 xdebug。
- Configure xdebug in your php engine properly.
- Edit the preference by going Preference -> Aptana Studio -> Editor -> PHP Interpreter.
- Add a PHP interpreter and save it.
- Now create a new Web Server if no web server is currently working.
- Now Apply the changes.
- Next, Edit the Debug Configuration using Run -> Debug Configurations -> PHP Web Page.
- Add a new web page by selecting a initial script file for the php project.
- In the last step, start debugging.
- 在你的 php 引擎中正确配置 xdebug。
- 通过转到 Preference -> Aptana Studio -> Editor -> PHP Interpreter 来编辑首选项。
- 添加一个 PHP 解释器并保存它。
- 如果当前没有网络服务器在工作,现在创建一个新的网络服务器。
- 现在应用更改。
- 接下来,使用 Run -> Debug Configurations -> PHP Web Page 编辑调试配置。
- 通过为 php 项目选择一个初始脚本文件来添加一个新网页。
- 最后一步,开始调试。
You can find a details step by step procedure in the following link: http://devcircle.blogspot.com/2013/02/enable-xdebug-in-aptana-studio-3x.html
您可以在以下链接中找到详细的分步过程:http: //devcircle.blogspot.com/2013/02/enable-xdebug-in-aptana-studio-3x.html
Hopefully it helps to solve the problem.
希望它有助于解决问题。
回答by Der Zinger
For me it worked only after 1. Performing stuffs from here (basically - setting-up the XDebug for remote debugging) https://jira.appcelerator.org/secure/attachment/26404/ScriptPHPDebugging.pdf2. installation of "XDebug helper" for chrome, and something similar for FF.
对我来说,它仅在 1. 从这里执行操作(基本上 - 为远程调试设置 XDebug) https://jira.appcelerator.org/secure/attachment/26404/ScriptPHPDebugging.pdf2. 安装“XDebug helper” " 对于 chrome,类似的东西对于 FF。
After that I have my remote sessions working just-like-they-did-in-Eclipse.
之后,我的远程会话就像他们在 Eclipse 中所做的那样工作。