可以将Zend PDT(eclipse)链接到浏览器操作吗? [英] Can I link the Zend PDT (eclipse) to a browser action?

查看:158
本文介绍了可以将Zend PDT(eclipse)链接到浏览器操作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在eclipse中配置Zend PDT调试器,以类似于Eclipse调试器的方式从浏览器操作中点击一个断点?即设置一个断点,启动调试器,浏览一个站点,然后在命中时放入一个断点。

Is it possible to configure the Zend PDT debugger in eclipse to hit a breakpoint from a browser action in a similar way to that of the Java debugger for eclipse? I.e. Set a breakpoint, start the debugger, browse a site then drop into a breakpoint when it is hit.

我可以调试各个脚本和网页,但是我正在尝试调试从网页调用的脚本。我正在使用Joomla,并希望能够遍历依赖堆栈,同时点击页面内容。

I can debug individual scripts and Web pages however I am trying to debug a script that is called from a webpage. I am using Joomla and want to be able to traverse the dependency stack while click on page content.

提前感谢任何建议..!

Thanks in advance for any advice..!

推荐答案

我发现如何做到这一点,但是相当长的时间。它使您能够调试PHP,就像您调试Java一样,您可以浏览您的站点,只有当您点击其中一个断点时,才会进入调试器。这是Linux的配置。

I found out how to do this but it is quite long winded. It enables you to debug PHP like you debug Java as in you can browser your site and only drop into the debugger when you hit one of your break points. Here's the config for Linux.

首先你需要安装和配置Zend Debugger :

First you will need to install and configure the Zend Debugger:


  • 确保安装了Eclipse PDT(PHP开发工具)。如果没有:
    将此存储库添加到帮助>安装新软件...中的源列表中: http://download.eclipse.org/releases/helios

  • 展开编程语言包,并选择PHP开发工具(PDT)SDK功能。

  • 点击下一步安装。

  • 通过将这个存储库添加到您的源列表中,以相同的方式安装Zend PDT: http://downloads.z​​end.com/pdt


    • 展开 Zend CE功能,然后选择 Zend Debugger功能,然后点击下一步

    • Ensure you have the Eclipse PDT (PHP Development Tools) installed. If not: Add this repository to your sources list in Help > Install New Software...: http://download.eclipse.org/releases/helios
    • Expand the Programming Languages package and select PHP Development Tools (PDT) SDK Feature.
    • Click next and install.
    • Install the Zend PDT in the same way by adding this repository to your sources list: http://downloads.zend.com/pdt
      • Expand Zend CE Features and select Zend Debugger Feature then click Next.

      将php.ini配置为指向ZendDebugger.so文件。

      Configure php.ini to point to the ZendDebugger.so file.


      • 第一个类型

      • First type

      php5 -i | grep加载Conf

      php5 -i | grep "Loaded Conf"


    • 进入终端找到正确的php.ini文件你需要编辑并在文本编辑器中打开它

      into a terminal to find the correct php.ini file you need to edit and open it in a text editor


      • 下一个类型

      • Next type

      终于将ZendDebugger.so

      locate ZendDebugger.so


      到php5调试器文件。

      into a terminal and copy the location to the php5 Debugger file.


      • 将这些行添加到php.ini文件的底部:


      • Add these lines to the bottom of your php.ini file:


      [Zend]

      Zend_extension =[ZendDebugger.so文件的路径]

      zend_debugger.allow_hosts =127.0。 0.1,[如果需要您的IP地址]

      zend_debugger.expose_remotely = always

      替换您的locate命令和您的IP地址返回的路径。

      [Zend]
      Zend_extension="[path to your ZendDebugger.so file]"
      zend_debugger.allow_hosts="127.0.0.1, [your IP address if required]"
      zend_debugger.expose_remotely=always
      substituting in the path returned from your locate command and your IP address.



      键入


      sudo /etc/init.d/apache2 restart

      sudo /etc/init.d/apache2 restart

      进入终端。

      然后键入


      php5 -m

      php5 -m

      命令进入您的终端,以确保Zend调试器配置正确。你会看到如下:

      command into your terminal to ensure the Zend Debugger is properly configured. You will see something like:



      xmlreader

      xmlwriter

      Zend调试器

      zip

      zlib



      [Zend Modules]
      Zend Debugger

      xmlreader
      xmlwriter
      Zend Debugger
      zip
      zlib

      [Zend Modules] Zend Debugger


      在转储结束附近。如果您没有看到Zend Debugger,那么请确保您已经编辑了正确的php.ini文件,并确保您的ZendDebugger.so文件的路径有效。确保重新启动PHP以进行任何更改传播。

      near the end of the dump. If you don't see the Zend Debugger then make sure you have edited the correct php.ini file and ensure that the path to your ZendDebugger.so file is valid. Make sure to restart PHP for any changes to propagate.

      接下来,您将必须配置Eclipse:

      Next you will have to configure Eclipse:


      • 首先转到窗口>首选项> PHP> PHP可执行文件,并确保安装最新的PHP CLI库并将其设置为默认值。

      • 接下来,通过转到窗口>打开透视图>其他>添加eclipse中的PHP调试透视图PHP调试

      • 现在转到窗口>首选项> PHP>调试,然后单击配置项目特定设置。

      • 选择要调试的项目,然后单击确定。

      • Firstly go to Window > Preferences > PHP > PHP Executables and make sure the latest PHP CLI libraries are installed and set as default.
      • Next add the PHP Debugging perspective in eclipse by going to Window > Open Perspective > Other > PHP Debug.
      • Now go to Window > Preferences > PHP > Debug and click Configure Project Specific Settings.
      • Select the project you want to debug and click OK.


      • 选中启用项目特定设置。
      • 这些是您需要的设置:



      PHP调试器: Zend调试器

      服务器: [您的项目的本地URL路径(应该confi ]]

      PHP可执行文件: 5.3.x(或更高版本)



      默认基本URL /基本路径: /

      自动生成的基本URL: http :// [本地项目的URL路径]

      PHP Debugger: Zend Debugger
      Server: [local URL path to your project (should configure this in hosts file)]
      PHP Executable: 5.3.x (or later)

      Default Base URL / Base Path: /
      Auto-generated Base URL: http://[local URL path to your project]





      • 取消选中第一行中断选项,然后单击确定关闭配置窗口,然后取消选中主PHP调试页面上的相同选项。单击应用以保存设置。


      • http :// [本地您的项目的URL路径]

        http://[local URL path to your project]

        这应该是与您的您在dev中使用的主机配置可以访问您的主页。给配置一个名称,并将其设置为默认值。单击完成,然后单击确定,然后重新启动Eclipse。

        this should be the same URL as in your host config that you use in dev' to get to your home page. Give the config a name and set it as default. Click Finish and OK then restart Eclipse.


        • 接下来转到窗口>首选项>常规>网络浏览器,选择使用外部Web浏览器并选择浏览器你想在调试期间进行交互。 > 注意: 请勿使用FIREFOX! Zend PDT绑定到它,您不能将浏览器与调试器分离,而无需卸载并重新安装Firefox。 Opera浏览器与Zend PDT一起工作得最好,所以这里是如何添加的:

        • 安装Opera浏览器后,进入窗口>首选项>常规> Web浏览器设置再次选择新建并使用以下参数:

        • Next go to Window > Preferences > General > Web Browser, select Use external web browser and choose a browser you want to interact with during debugging. >Note:> DO NOT USE FIREFOX! The Zend PDT binds to it and you cannot decouple the browser from the debugger without uninstalling and reinstalling firefox. The Opera browser works by far the best with the Zend PDT so here's how to add it:
        • After installing the Opera browser go to the Window > Preferences > General > Web Browser settings again and select New and use these parameters:



        名称:Opera

        位置: / usr / bin / opera

        参数:%URL%

        Name: Opera
        Location: /usr/bin/opera
        Parameter: %URL%


        单击确定,选择Firefox,如果它存在并删除它,然后检查Opera,然后单击确定。

        click OK, select Firefox if it exists and remove it then check Opera and click OK.

        再次重新启动Eclipse,您将可以开始调试PHP。

        Restart Eclipse again and you will be ready to start debugging PHP.


        • 在PHP透视图中,打开一个PHP文件,然后从项目菜单中选择 Debug as> PHP Web页面,或者选择Debug图标旁边的向下箭头。

        • 您可能会看到一个警报窗口,要求您确认调试URL。在基地址后删除eveything,只留下:

        • In the PHP perspective open a PHP file and select Debug as > PHP Web Page either from the Project menu or by selecting the downward arrow beside the Debug icon.
        • You may see an alert window asking you to confirm the debug URL. Remove eveything after the base URL to leave just:



        http:// [本地项目的URL路径]

        http://[local URL path to your project]


        作为URL,然后单击确定。

        as the URL and click OK.

        如果eclipse没有自动切换到PHP调试透视图,那么手动切换到。

        If eclipse doesn't switch to the PHP Debug Perspective automatically then switch to it manually.


        • 当PHP调试会话启动有时会话在页面加载之前结束,浏览器中的页面保持空白。尝试右键单击调试堆栈视图中的会话并选择重新启动。

        • 首次启动调试会话时,请确保浏览器窗口中的URL显示为您配置的基本URL,即删除Zend附加到URL的任何调试器参数。

        • 为了更顺利的调试,在完成PHP开发之前,从PHP Debug透视图中删除所有终止的调试会话。

        • 小心避免关闭日食,而PHP Debug透视图是关注的,因为需要很长时间才能关闭。

        • When the PHP debug session starts sometimes the session ends before the page loads and the page in the browser stays blank. Try right clicking the session in the debug stack view and select Relaunch.
        • When a debug session starts up first time make sure the URL in the browser window appears as the base URL you configured i.e. remove any debugger parameters that Zend appends to the URL. URLs should appear cleanly from now on.
        • For smoother debugging remove all terminated debugging sessions from the PHP Debug perspective before your finish your PHP development.
        • Be careful to avoid shutting eclipse down while the PHP Debug perspective is in focus as it will take a long time to close.

        这篇关于可以将Zend PDT(eclipse)链接到浏览器操作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆