Win下的Zend Studio调试Linux下的程序

LUOPING0 2011-04-11

一. 安装linux ZendDebugger

这里下载Studio Web Debugger

然压后选择合适版本的ZendDebugger.so

复制到/usr/lib/php/modules/目录

复制dummy.php到站点根目录

vi /etc/php.ini

加入以下内容

[Zend Debugger]

zend_extension="/usr/lib/php/modules/ZendDebugger.so"

zend_debugger.allow_hosts=127.0.0.1/32,10.0.0.0/8,192.168.0.0/16,172.16.0.0/12

zend_debugger.expose_remotely=1

zend_debugger.passive_mode_timeout=180

重启服务器就行了

各配置选项的含义参见这里

二.验证安装成功及设置调试

sh# php -v (有可能是与zend_optimizer冲突)

Zend Studio配置:

工具->首选项->调试 调试方式选服务器,debugger server url为网站的浏览地址,dummy.php就是放在这个目录下

重启IDE,进行调试

zend studio 7.0以上的版本操作:

1 ) .  先为studio添加新的服务器源,则你的linux web server地址

英文help:

To add a new server to the list or edit an existing server configuration:

Click New

-Or- select an existing server and click Edit.

Enter the name of your server.

Enter the URL that points to its document root.

Click  Next.

The Server Path Mapping dialog appears.

If you would like to map a path on your server to a local path, click Add and enter:

The path on your server.

The path you would like to map it to in your Workspace or on your File System.

See Adding a Server Location Path Map for more information.

If you would like to enable integration with Zend Server, mark the 'Enable Zend Server  Integration' checkbox and enter the relevant information:

URL Suffix - The suffix which should be added to the URL of your document root in order to browse to your Zend Server GUI.

Port number - Enter the port number you defined during Zend Server installation.

See the Zend Server FAQ site for default port number settings.

Password - The password used to access your Zend Server GUI.

If you would like to enable integration with Zend Platform, mark the 'Enable Platform Integration' checkbox and enter the relevant information:

Platform GUI

Authentication - Your Platform User Name and Password

For more, see Defining a Platform Server.

Click Finish.

2) .  安装zend debugger

The Installed Debuggers Preferences page is accessed from Window | Preferences | PHP | Debug | Installed Debuggers.

DEBUG->installed Debugger-> Zend Debugger settings->Client Host/IP

其他的配置选项默认。

3). 测试

To debug a PHP Web Page

run -> debug config -> 新建一个测试 -> "Test Debugger"

查看是否正确,根据提示找原因修正错误!!

注意点、重点:

在安装完linux下的Zend Debugger,配置完后进入测试。发现怎么测怎么有错,也不能正常进行调试。后来找了一天的帮助文档,经过努力终于解决了问题:

1. 先查找你的linux web server 中的php扩展是否有 xcache.so,通过phpinfo()查看。

我这里会有Additional .ini : /etc/php5/cgi/conf.d/xcache.ini

2.  如果不需要请去掉扩展xcache的配置文件xcache.ini, 重启php

3.  再度Test Debugge -》 OK

虽然会出现另一个出错提示,但是不会影响调试功能。

注:

zend studio中的help

To set up communication between Zend Studio and the server on which you are debugging:

Ensure the Zend Debugger is installed on your server.

The Zend Debugger comes bundled with Zend Server , Zend Core and Zend Platform , but can also be downloaded as a separate component from http://www.zend.com/en/products/studio/downloads .

Ensure the machine on which your Zend Studio is installed is an allowed host for your debugger.

The method for configuring this setting will depend on whether you have Zend Server, Zend Platform, Zend Core, or the standalone Zend Debugger installed on your system.

See Setting your Zend Studio to be an Allowed Host for more information.

In Zend Studio, configure your server according to the instructions under Adding Servers in the PHP Servers Preferences .

Ensure the correct settings are configured in your Debug Preferences and Installed Debuggers Preferences pages.

Ensure you have a dummy.php file in your remote server's document root.

If your server is situated behind a firewall or other security device, see Setting Up Tunneling for information on how to enable a communication tunnel.

If you don't know whether your server is situated behind a firewall, contact your System Administrator.

相关推荐