Home  >  Article  >  php教程  >  建立php开发环境(XAMPP + Xdebug+Zend Studio)

建立php开发环境(XAMPP + Xdebug+Zend Studio)

WBOY
WBOYOriginal
2016-06-06 19:49:251097browse

1. 安装XAMPP和Zend Studio Zend Studio下载地址: http://pan.baidu.com/s/1o6BjvAE XAMPP 下载地址: http://pan.baidu.com/s/1ntkNcEX 正常安装即可。 2. 配置Xdebug 在XAMPP的安装目录下,查找php文件夹,编辑php/php.ini文件。找到[XDebug],并编辑内容

1. 安装XAMPP和Zend Studio

Zend Studio下载地址: http://pan.baidu.com/s/1o6BjvAE

XAMPP 下载地址: http://pan.baidu.com/s/1ntkNcEX

正常安装即可。

 

2. 配置Xdebug

在XAMPP的安装目录下,查找php文件夹,编辑php/php.ini文件。找到[XDebug],并编辑内容如下:

<span>[XDebug]
zend_extension </span>= "D:\xampp\php\ext\php_xdebug.dll"
<span>xdebug</span>.remote_enable = 1<span>
xdebug</span>.remote_handler = "dbgp"<span>
xdebug</span>.remote_host = "127.0.0.1"<span>
xdebug</span>.remote_port = 9000

这时候重启apache(在XAMPP控制台里就能重启)。然后在浏览器上输入http://localhost/就会进入xampp的欢迎页,在左右菜单中点击phpinfo链接,能搜索到”Xdebug“字眼就算配置成功。如下:

This program makes use of the Zend Scripting LanguageEngine:
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.1, Copyright (c) 2002-2011, by Derick Rethans

 

3. 在Zend Studio中创建工程

  1. 3.1 新建工程

  2. 打开Zend Studio的“File ->New -> Local PHP Project”菜单创建一个PHP工程。工程的路径可以随便放,比如说我就放在D:\Zend\workspaces\DefaultWorkspace10目录(呆会要在apache中配置这个目录),注意,Content选择Basic,不要选择ZendFramework (Zend Framework是php世界里的一个web框架,我们现在不用它)。
  3. 接着,配置Lanch Settings, 因为我们是B/S程序,所以选择”LauchURL”,如果你的是C/S客户端脚本,你就选”Launch CLI Application”。注意:在Base Path处输入 / 。之后按默认进行,略。

3.2 配置XAMPP的apache

配置指向D:\Zend\workspaces\DefaultWorkspace10目录

  1. 编辑D:\java\xampp\apache\conf\httpd.conf将下列两处的‘D:/java/xampp/htdocs“替换成”D:\Zend\workspaces\DefaultWorkspace10”

这两处分别是:

  • DocumentRoot "D:\Zend\workspaces\DefaultWorkspace10"
  • #DocumentRoot "D:/java/xampp/htdocs"
  • #
  1. 验证,重启apache。

 

3.3 配置Zend Studio使用XDebug

需配置让Zend Studio使用Xdebug来调试,而不是默认的Zend Debugger, 在Window-->Preferences -> PHP Debug菜单里进行全局配置。

PHP Debugger里一Web要选择Xdebug。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn