PHP Eclipse PDT debug调试环境搭建
本贴子使用的环境 为: win7 32 PHP Version 5.2.17 thread safe apache 2.2 Zend Eclipse PDT Studio Web Debugger 之前一直是搞J2EE的,最近公司要用到PHP,想自己搭下PHP的开发环境,怎耐周围没有熟悉的人。。。 只能自己动手丰衣足食,其中遇到不少困难
本贴子使用的环境 为: win7 32 + PHP Version 5.2.17 thread safe +apache 2.2 + Zend Eclipse PDT +Studio Web Debugger
之前一直是搞J2EE的,最近公司要用到PHP,想自己搭下PHP的开发环境,怎耐周围没有熟悉的人。。。
只能自己动手丰衣足食,其中遇到不少困难,于是心想这PHP不是最流行的WEB开发语言么,怎么配置起来
这么困难,本人认为最困难的是eclipse +xdebug +zend debugger +php它们都有N个版本,能组合上统一的
版本是多么的困难,尽管网上有N多教程,但看了之后发现和自己装的都不一样。
于是乎决定如果弄好这个环境一个一定要自己写一个贴子,分享给大家。
http://blog.csdn.net/gaochh01/article/details/6949178
这里我们重点讲eclipse的DEBUG调式环境
1.首先下载eclipsePDT,这里有一个集成了所有PHP需要的组件的下载地址,有了它, 你就不用麻烦的去下eclipse又去找对应的php插件了,
它集成了所有php所要用的插件,具体请看下面的链接
http://www.zend.com/en/community/pdt/downloads
找到windows 版本的下载TAB页,你需要下载 1. Zend Eclipse PDT PDT 3.0.2 w/Eclipse Indigo
2.Studio Web Debugger
分别解压 eclipse-php-3.0.2.v20120511142-Win32.zip
和 ZendDebugger-20110410-cygwin_nt-i386.zip
你会发现 ZendDebugger-20110410-cygwin_nt-i386 下有N个文件夹,4_3_x_comp,4_4_x_comp。。。。。,这要选
哪一个是好呢? 别急,首先我们安装的是PHP Version 5.2.17 thread safe 版本的php,所以我们选择5_2_x_comp 文件夹里的
内容,你要问了5_2_x_nts_comp 这个是作什么的, 我来给你讲一下他们的区别
5_2_x_comp 是针对 thread safe版本的php
5_2_x_nts_comp 是针对 non -thread - safe版本的php,因为我们装的是 PHP Version 5.2.17 thread safe,所以我们使用5_2_x_comp
打开5_2_x_comp 里面有一个 ZendDebugger.dll文件
1).copy ZendDebugger.dll 到 [your php path]/ext/ 例如我的路径为:C:\Web\php\ext
2).打开 php.ini文件 在最后加上
[zend debugger]
zend_extension_ts="C:\Web\php\ext\ZendDebugger.dll";同样注意ts和完整的路径。这里写你自己的php安装路径
zend_debugger.allow_hosts=127.0.0.1;允许调试的主机IP,
zend_debugger.expose_remotely=always;
3).打开apache /conf/httpd.conf文件,在356行左右加入
Alias /pdt/ "D:/workspace3.3_PHP/"
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
你又要问了 这是干什么?
其中D:/workspace3.3_PHP/ 是你eclipse的工作目录 ,大概意思就是如果你请pdt它会给你转到 D:/workspace3.3_PHP/,可能不太准确
但意思差不多
重启apache后,你就可以直接通过 http://localhost/pdt/去直接访问eclipse工程中的D:/workspace3.3_PHP/ 文件了,这会在之后用到
4).copy C:\Web\php PDT\ZendDebugger-20110410-cygwin_nt-i386 中的 dummy.php到 appache /conf/htdocs 文件夹内
重启 apache 服务
如果你在phpinfo()中看到
Zend Debugger
Passive Mode Timeout | 20 seconds |
Directive | Local Value | Master Value |
---|---|---|
zend_debugger.allow_hosts | 127.0.0.1 | 127.0.0.1 |
zend_debugger.allow_tunnel | no value | no value |
zend_debugger.deny_hosts | no value | no value |
zend_debugger.expose_remotely | always | always |
zend_debugger.httpd_uid | -1 | -1 |
zend_debugger.max_msg_size | 2097152 | 2097152 |
zend_debugger.tunnel_max_port | 65535 | 65535 |
zend_debugger.tunnel_min_port | 1024 | 1024 |
那么恭喜你,已经成功一半了
,接下来我们打开eclipse PDT,当然我们的workspace是之前apache httpd.conf 配置中的D:/workspace3.3_PHP/
1). windows ----> preference ---> PHP----->PHP Executables ----------->add
name : test 此项随意
Exceutable path: C:\Web\php\php.exe 你自己的php安装路径
PHP ini file :C:\Web\php\php.ini 你自己的php安装路径
SAPI TYPE: CLI
PHP debugger: Zend Debugger
然后确认保存
2).windows ----> preference ---> PHP---------> PHP Servers
name : Default PHP Web Server 随意
Base URL: http://127.0.0.1
local Web Root: 空
然后确认保存
3). windows ----> preference ---> PHP------------->Debug
PHP Debugger : Zend Debugger
Server: Default PHP Web Server(2中配置的)
PHP Excutable:test (1 中配置的)
4).Enable CLI Debug 前面勾打上
然后确认保存
5).新建一个PHP工程 name:test
新建一个php文件 new.php
输入:
6):点击debug configuration ----------->PHP Web Application
双击新建一个configration Name :随意
Server
Debugger: Zend Debugger
PHP Server : Default PHP Web Server (之前步骤中创建的)
File : 选中 /test/new.php
URL 下 auto Generate 前面的勾去掉
URL: http://127.0.0.1/ /pdt/test/new.php这处注意修改
你又要问了 为什么要加pdt ?? ,因为我们之前在apache /conf/httpd.conf
Alias /pdt/ "D:/workspace3.3_PHP/"
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
如果不加pdt 默认请求的是C:\Web\apache\htdocs目录下的文件,就会提示找不到
/test/new.php,这样你知道为什么要加ptd 了吧
然后点击debug,你就可以像调试java一样在new.php中打断点进行调试了

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics





PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
