Home > php教程 > php手册 > body text

php的eclipse环境搭建

WBOY
Release: 2016-06-06 19:52:37
Original
980 people have browsed it

php做开发一般使用常用的集成开发环境如xampp,wamp等就已经够用,但在某些环境如微信这样场景,就明显不够用了,因为它即使出错也不会返回错误信息。 烦恼良久,决定从我最熟悉的eclipse下手,搭一个本地调试环境。 准备工作: 1.下载Eclipse for PHP http:

       php做开发一般使用常用的集成开发环境如xampp,wamp等就已经够用,但在某些环境如微信这样场景,就明显不够用了,因为它即使出错也不会返回错误信息。

烦恼良久,决定从我最熟悉的eclipse下手,搭一个本地调试环境。

       准备工作:
       1.下载Eclipse for PHP  http://www.eclipse.org/downloads/
       2.下载Apache               http://httpd.apache.org/download.cgi   (想要windows版本的来这下 http://www.apachelounge.com/download/)
       3.下载php                      http://www.php.net/downloads.php
       4.下载xdebug           http://www.xdebug.org/download.php
       5.mysql数据库         这个基本是标配了      
        由于本地已经有了一个集成开发环境wamp,所以我是直接粘贴的apache和php,放在我的d盘的APM目录下面。下面来对它进行一些配置。
       
        如果是下载的apache,安装比较的简单,安装目录可选择d:/APM下,这个看自己喜欢起名。一路下一步,其中有一个地方就叫你添加三个地址,自己想好,按照例子填写。
我是写上 localhost.com  www.localhost.com  master@localhost.com。像我的直接粘贴的,后面再说。
       在d:\AMP\Apache2\conf 找到http.conf,  添加对php的支持

LoadModule php5_module D:/APM/php5/php5apache2.dll
AddType application/x-httpd-php .php
PHPIniDir "D:/APM/php5"
Copy after login

更改项目默认路径    


DocumentRoot "D:/www"

如果你是用Eclipse开发,要写到工作区。
DocumentRoot "D:\www"

你要访问地址是这样的http://localhost/www/*.php
在PHP安装目录D:\php找到php.ini-dist,将其命名为php.ini
   

下面来对eclpse做配置,
 上面下载的xdebug.dll拷到d:/APM/php/ext/下面,然后打开php.ini编辑
 

;onload Xdebug
zend_extension_ts="D:\APM\php5.4.16\ext\php_xdebug-2.2.5-5.5-vc11.dll"
;xdebug configuration
[Xdebug]
xdebug.auto_trace = On
xdebug.show_exception_trace = On
xdebug.remote_autostart = On
xdebug.remote_enable = On
xdebug.collect_vars = On
xdebug.collect_return = On
xdebug.collect_params = On
Copy after login
自己替换下上面的路径。

进入Eclipse,从主菜单打开"Window > Preferences > PHP"。先选中"PHP Excutables"节点,在右面的面板点"Add"按钮,在接下来的窗口中,"Name"随便填,我命名为PHP5,"Excutable Path"浏览到你的php.exe,PHP ini file浏览到你的php.ini文件,PHP Debugger选XDebug。如果最新版会有一个SAPI TYPE,保持默认。
 
选中"PHP Servers"节点,在右面的面板点"New"按钮,在接下来的窗口中,"Name"随便填,"URL"填你的工作空间的URL(比如http://localhost/pdt)。这个其实在最新版可以不用设置,因为有一个默认的Server,你直接用就行。


自此,配置已基本完成。

  测试步骤,不懂的可以参考此文章
http://ekliu939.blog.163.com/blog/static/131368072201032801359548/ 

   

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!