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

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.

 


 



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值