配置搭建EasyPHP5.3.6.1+Eclipse4.2.0+xDebug的PHP开发环境

来源:互联网 发布:刘琨 祖逖 知乎 编辑:程序博客网 时间:2024/05/29 06:44

Suppose we've already had EasyPHP5.3.6.1 installed. It comes with PHP 5.3.6.

(By the way, you can access phpMyadmin from: localhost/home/mysql/)


Step 1: Install Eclipse for PHP Dev:


(1). Download JDK and install it, and then add '../bin/' to PATH environment variable.

(2). Download Eclipse4.2, and then follow the instructions on this page to install PHP development package:PDT/Installation


Step 2: Install and Setup xDebug


Download the latest version from http://www.xdebug.org/download.php.


EasyPHP has already included xDebug2.1.1, you can view that by visiting: http://127.0.0.1/home/index.php?to=phpinfo



My following steps were referenced to these blogs:

http://www.bwcsc.net/?q=node/644

http://be-evil.org/post-70.html

http://aofengblog.blog.163.com/blog/static/631702120117283414706/


They all started at installing xDebug manually, but we already have it, so I also skip their steps of configuration for xDebug. I just started at setting Eclipse.


Go to [Window=>Preferences], select 'PHP' to expand its nodes, and select 'PHP Executables', see:



Not like the shot, there used to be nothing in my case, so I click 'Add':



Fill in the blanks, the Name is arbitrary. Others depends on your situation.


Then go back to PHP->Debug panel, see:


 

Click 'PHP Server' to config:



When I went here first time, it was not like this(as the snapshot, it was taken afterward), its name is something else, and the URL is 'http://localhost/', so click 'Edit', go:


 

Somebody said that the Site Map need to be set as well, but in my case, I just left it. Because I am using EasyPHP, I should use 127.0.0.1 instead of localhost, or you can map that by editing C:/windows/system32/driver/ect/host.


Finally, it would be something like:



Step 3: Try It


Now reopen Eclipse, open one PHP script, add break-point:



Debug the site:


There would prompt a dialog to ask for your confirmation for letting the debug plugin change the perspectives for the first time run, and you can just click OK.



Some shortcuts: 

1. Ctrl-Shift-B: set breakpoint; 

2. F5: step in; 

3. F6: step out; 

4. F8: run;




Conclution: How to Debug PHP Web App


Although you see it is such a big deal with configuring Eclipse and xDebug (or some other debug tools should be similar, I guess), it can't do much for you. I did a kind of experiment, trying to change something and see if it would make some differences~~~ not much indeed. 


For example, the panel of PHP server:

PHP Server Setting


It doesn't matter whether you fill into it with 'C:\EasyPHP-5.3.6.1\www' or 'C:\EasyPHP-5.3.6.1\www\somesubpath'. And it doesn't matter either whether you set a mapping path or not. You provide more information here just doesn't make it a little bit cleverer at all.


So, what does really matter? When you select a PHP script file, say../subpath/anothersubpath/some.php, and go to [debug->debug as PHP application], which will bring up a confirm box, being filled with a default URL, asking you if you wanna use that value or change it as you want, like: 



and this default URL is just matching its local directory in file system(http://yourdomainname/subpath/anothersubpath/some.php), so you may change it in mainly two cases:

1. you are using a MVC framework, like I am now, the file can't be request directly, it always be called via routing from the entry point(index.php usually);

2. you are mapping your certain path to a domain name, as virtual host always is.


So, you just figure it out on your own, and keep in mind that, your debug URL(should be filled into the above box), just depends on your Web server configuration(Apache.i.e), nothing else. How can you access it through browser, then how you fill in it.



After that, you launch a debug session, and the perspective would change, just as you see in the above screen shots, including a browser which is shipped with Eclipse, it's built in, I guess. And you may notice that the URL are appended with some parameters, like DEBUG_SESSION_KEY, fortunately, you can copy this URL and paste it into your other browsers, such as Chrome and Firefox----to continue your debug, that is just fine.


This approach of debug can be adequate for most of occasions.

 


 



原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 我有个破袄…没有衣服怎么办办 轩辕传奇手游灵宠融合错了怎么办 各尧学生不能用怎么办? 山东一卡通商务卡丢了怎么办 和信通过期了怎么办 和信通过期怎么办延期 和信通过期余额怎么办 超市储蓄卡丢了怎么办 提现提到注销卡怎么办 美通卡过期2年了怎么办 物美美通卡丢失怎么办 网上购物电话留错了怎么办 微信斗牛一直输怎么办 微信斗牛输了钱怎么办 微信举报诈骗不成功该怎么办 沙河拿服装太贵怎么办 包上的暗扣掉了怎么办 银手镯暗扣松老是掉怎么办 包包纽扣锁坏了怎么办 包的纽扣坏了怎么办 包上的纽扣坏了怎么办 洗衣服不小心用了色渍净怎么办 洗衣服不小心沾了卫生纸怎么办 麻料裤子扎皮肤怎么办 衣服没洗干净有点发光怎么办 桑蚕丝衣服脏了发光洗不掉怎么办 厨师衣服的油味怎么办 看上夜场的小姐了怎么办 楼卖完了水吧员怎么办 窗帘短了20公分怎么办 白色鞋子沾油了怎么办 面试时没有正装怎么办 宝宝喝了沐浴露怎么办 开实体童装店没人买怎么办 宝宝一岁半了还不会说话怎么办 十个月宝宝不吃辅食怎么办 八个月宝宝不吃米糊怎么办 八个月宝宝不吃辅食怎么办 六个月宝宝不吃米粉怎么办 4个月婴儿积食怎么办 黑色的衣服泛红怎么办