其实,文章的重点是放在了如何配置php的xdebug环境,毕竟环境搭好了,像NetBeans,Eclipse这样的IDE,随便哪个都可以做php的调试的。
操作环境:
OS: Ubuntu 10.04
Server: xampp 1.7.3a
1. 下载xdebug.so
方便懒人,不用去编译,所以就提供一个32位的xdebug.so。
http://download.csdn.net/source/2757538
下载好之后,把文件放到(注意这个跟你安装xamp的路径不同而不同,这个是通用的安装路径)
/opt/lampp/lib/extensions
2. 配置php.ini
打开 /opt/lampp/etc/php.ini,添加以下内容
代码
zend_extension
=/
opt
/
lampp
/
lib
/
php
/
extensions
/
xdebug.so
[debug]
; Remote settings
xdebug.remote_autostart = off
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_host = 127.0 . 0.1
xdebug.remote_port = 9000
; General
xdebug.auto_trace = off
xdebug.collect_includes = on
xdebug.collect_params = off
xdebug.collect_return = off
xdebug.default_enable = on
xdebug.extended_info = 1
xdebug.manual_url = http: // www.php.net
xdebug.show_local_vars = 0
xdebug.show_mem_delta = 0
xdebug.max_nesting_level = 100
;xdebug.idekey =
; Trace options
xdebug.trace_format = 0
xdebug.trace_output_dir =/ tmp
xdebug.trace_options = 0
xdebug.trace_output_name = crc32
; Profiling
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
[debug]
; Remote settings
xdebug.remote_autostart = off
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_host = 127.0 . 0.1
xdebug.remote_port = 9000
; General
xdebug.auto_trace = off
xdebug.collect_includes = on
xdebug.collect_params = off
xdebug.collect_return = off
xdebug.default_enable = on
xdebug.extended_info = 1
xdebug.manual_url = http: // www.php.net
xdebug.show_local_vars = 0
xdebug.show_mem_delta = 0
xdebug.max_nesting_level = 100
;xdebug.idekey =
; Trace options
xdebug.trace_format = 0
xdebug.trace_output_dir =/ tmp
xdebug.trace_options = 0
xdebug.trace_output_name = crc32
; Profiling
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
3. 记得重启服务器!
sudo
/
opt
/
lampp
/
lampp restart
4. 用 NetBeans 打开一个项目,添加断点,调试!