Aptana Studio 3 中使用 XDebug

17

我想知道如何在Aptana Studio 3中使用XDebug(已经在这台机器上安装了Aptana Studio 3与XAMPP)。

您是否知道一篇最近的文章,告诉我如何做到这一点并解释XDebug?我没有任何关于XDebug的经验或知识,我查找了一些文章,但它们似乎都已过时。

5个回答

13
我知道这是一个旧帖子,但我也曾经很难找到如何使用Aptana Studio和FireFox调试php的方法,所以这里有一个快速的教程来让它工作...最简单的方法是安装wamp server V2.2,这是一个非常有用的程序,因为它安装了Apache服务器、PHP和MySQL等工具,一切都可以通过任务栏轻松配置。
1.) 安装 Aptana Studio V3.3.X或更高版本 下载链接 2.) 安装 WampServer V2.2 或更高版本 下载链接(XAMMP用户请查看底部)。

WampServer:

1.) 确保XDebug接受远程调试,点击任务栏中的WampServer图标,然后进入PHP->PHP设置,确保选中“(XDebug):远程调试”,如果没有选中,请选择它并单击WampServer图标,然后选择“重新启动所有服务”。

2.) 验证XDebug是否正在运行:     a.) 如果您在WampServer中插入了index.php,请在URL中输入“localhost”,然后在“工具”下单击“phpinfo()”,并检查XDebug是否正在运行。在FireFox中,您应该看到以下内容:

XDebug

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 

this

  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

最后,在Aptana Studio中,点击调试图标箭头并选择您上面命名的配置。如果Firefox提示您安装Aptana Studio插件...希望这能帮到您...

-------------

-------------

请按照以下步骤操作,但是在“偏好设置”对话框中,您的目录链接应该指向C:\xampp\php\php.exe和C:\xampp\php\php.ini:

转到Aptana Studio->编辑器->PHP->PHP解释器

*****更新*****

如果您使用的是Firefox V20 +,则Firebug V1.8 +存在一些兼容性问题,基本上会破坏Firefox的上下文菜单,我找不到解决方法,所以最终选择了另一种方式,并想着我应该发布一篇文章,Aptana Studio基于Eclipse,因此我认为最好的方法是安装带有PDT的Eclipse并删除Aptana Studio...以上说明将适用于使用XDebug进行调试的所有内容

以下是一个很好的链接,介绍如何使所有内容正常工作eclipse-pdt


7
目前,Aptana Studio 3中没有PHP调试器支持。不过,很快就会有了。请参见:http://jira.appcelerator.org/browse/APSTUD-769并将自己加入观察者列表以获取完成通知。
如果您真的需要调试功能,现在可以从eclipse.org安装PDT。他们也提供关于如何使用它的最新文档。学习曲线比较小,而且一旦Aptana发布后,它的操作方式几乎相同,所以您不会有任何损失 :)

2
现在支持 Aptana 的夜间版本 https://jira.appcelerator.org/browse/APSTUD-769 - dotoree
是的!我把它放在那里让你试用并提供反馈,请一定要试一试! :) - sgibly

3

以下是使用Aptana Studio 3.3配置和开始使用XDebug的简易操作指南,假设您已在系统中安装了xdebug。 (在Ubuntu / Linux中,只需执行 sudo apt-get install php5-xdebug 命令即可)。

配置调试器

在“ 首选项-> Aptana Studio-> PHP-> PHP解释器”中单击添加...,并指定名称,PHP可执行文件(在大多数Linux发行版中为/ usr / bin / php),php.ini(例如,在我的系统上为/etc/php5/conf.d/20-xdebug.ini),并将PHP调试器选择为XDebug。


使用调试器

创建一个php文件并写入一些代码:

<?php

$defined_var = 'some value';

echo $defined_var;
echo $undefined_var;

exit();

?>

保存并按“运行->调试为->PHP脚本”,您将被提示切换工作区。
通过双击行号旁边,例如在exit()函数的行上,指定一个断点。
按Resume(F8),您可以看到当前指针移动到了那里。
在变量选项卡中,您现在应该看到哪些变量有一些值或未初始化。输出可在控制台选项卡中找到。
再次按Resume将终止调试。
当然,这只是关于调试的冰山一角,但这是一个开始。还有许多其他选项可以探索和调试脚本的方法。

2
我使用 Aptana Studio 3.2.2 开发我的 Drupal 网站,并使用 XDebug 来调试项目。Aptana Studio 支持 xdebug。您需要按照以下步骤在 Aptana Studio 中启用 xdebug:
  1. 正确配置 php 引擎中的 xdebug。
  2. 通过选择 Preference -> Aptana Studio -> Editor -> PHP Interpreter 来编辑首选项。
  3. 添加一个 PHP 解释器并保存。
  4. 如果当前没有 Web 服务器正在工作,请创建一个新的 Web 服务器。
  5. 现在应用更改。
  6. 接下来,使用 Run -> Debug Configurations -> PHP Web Page 来编辑调试配置。
  7. 通过选择一个用于 php 项目的初始脚本文件来添加一个新的网页。
  8. 在最后一步中,开始调试。
您可以在以下链接中找到详细的步骤:http://devcircle.blogspot.com/2013/02/enable-xdebug-in-aptana-studio-3x.html 希望这能帮助解决问题。

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接