php环境配置及调试配置的方法
今日打算学习PHP,工具还是使用我熟悉的eclipse。为了php环境的配置和调试配置,我花了很大功夫研究哈,以下是整理出来的方法:
1.安装和配置PDT
下载PDT: download.eclipse.org/tools/pdt/downloads/index.php, 选择最新版本
PDT是Eclipse的插件。
选择pdt-all-in-one版本, 否则需要另外下载eclipse和相关插件, 并手工集成.
2.安装debug环境
由于我用的是最新的xampp1.7.2,试了二天xdebug,出现如下如题:waiting for xdebug session,停止的了57%的进度上,程序无法调试。可能是xdebug和php5.3之间的问题。因此决定改用旧版xampp1.6.8,php的版本是5.2.6。结果还是出现了以上问题,让我不得其解,不得以,换成zend debugger。
xampp版本为1.6.8,从这里下载zend debugger 5.2.x。将文件解压后复制到\xampp\php\ext目录。
打开\xampp\apache\bin目录下的php.ini。的最后添加:
zend_extension_ts = "c:\xampp\php\ext\ZendDebugger.dll"
zend_debugger.allow_hosts=127.0.0.1/10,192.168.88.146
zend_debugger.expose_remotely=always
其中192.168.88.146是你机子上的IP地址。
3.设置PDT下的debug环境
启动Eclipse,将code目录设置为"xampp\htdocs",这样代码直接放到apache的WEB目录下
从主菜单打开"Window > Preferences > PHP",
先选中"PHP Excutables"节点,在右面的面板点"Add"按钮,在接下来的窗口中,
选中"Debug"节点,在右面的面板中,
"PHP Debugger"选择XDebug,
"Server"不用变
"PHP Executable"也选择你刚刚添加的那个"xampp-zend"
在PHP Debug透视图中可以点击Debug View中的图标或用快捷键来进行单步跟踪,比如:
F5: 单步跳入(可以跳入require()函数来跟踪到别的PHP文件哟)
F6: 单步跳过
F7: 单步跳出(可以从被require()的文件内跳回调用者哟)
F8: 继续执行(直到遇到下一个断点)
Ctrl+R: 执行到光标所在行(除非遇到断点)

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

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

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

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
