[分享]怎么使用XDebug+NetBeans IDE 搭建PHP开发调试环境
[分享]如何使用XDebug+NetBeans IDE 搭建PHP开发调试环境
初学PHP开发,由于一直未能搭建一个可以Remote Debugging的环境,导致开发效率异常低下。
被MS惯坏了的我,显然无法习惯这种记事本+IE Explorer的开发模式。因此决定搭建一个可以进行Debug的PHP开发环境。
阅览多方资料后我决定使用NB+XDebug来搭建环境。由于搭建环境之步骤稍显繁琐,特此记录以备忘。
1,首先去下载NetBeans,目前最新版是NetBeans 7.0,注意选哪个带有PHP插件的。
为了方便起见,我下载的是包含了Full Features的版本。
给个链接:
http://netbeans.org/downloads/start.html?platform=windows&lang=zh_CN&option=all
2,下载你需要的XDebug的版本。
2.1 准备工作
在此之前确保你装上了xampp, 也就是一个PHP和Apache,MySql,Perl的整合套件。目前最新版本是1.7.4 Final。这里也给出一个下载链接
http://www.newhua.com/soft/50127.htm
2.2 测试XAMPP安装情况
如果一切就绪,浏览器输入http://localhost:80看是否正确安装Apache,PHP。
可以使用phpInfo()查看PHP特性安装情况。
2.3 安装XDebug
XDebug只是PHP的一个Extension。去XDebug的官网下载即可。
这里也给出一个下载地址
http://xdebug.org/download.php
注意的是,这里版本众多,如何选择需要再次开启浏览器,查看phpInfo函数的输出。根据PHP版本,PHP Build环境(VC6 or VC9),是否是Thread safe(TS)来选择一个合适的XDebug的版本即可。
3,XDebug的配置。
修改PHP.ini 的XDEBUG Section。
需要确保开启几个配置选项,一般来说建议开启如下几个选项。
zend_extension=”XDebug的路径”
例如”zend_extension=/php/ext/php_xdebug-2.1.0-5.2-vc6.dll”
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000 //默认是9000 建议该一下
然后重启Apache的服务。在phpInfo中查看XDebug Section下的配置项。
说明, 貌似XAMPP中的PHP.ini已经整合了XDebug只不过注释起来了。我们所要做的就是去掉注释即可。
4,NetBeans中Debug。
进入NetBeans,新建一个PHP项目,编写PHP代码。
然后使用”调试”菜单下的设置断点,步入(Step into), 步过(Step over)等MS的IDE常见的菜单功能项。
断点断住之后,你还能看到诸如Watch,Local等查看变量值的Window。是不是感觉很过瘾,从此开发PHP程序就可以告别简单的记事本+浏览器模式。拥有一个足以媲美VS开发环境的PHP IDE。更重要的是,这一系列工具都是免费的。

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

AI Hentai Generator
Generate AI Hentai for free.

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

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

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

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

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,

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.
