由于使用了xampp集成的环境,就直接使用默认的php.ini进行设置,昨天发现了xampp的独特之处之外,比如说它把虚拟主机的配置
httpd-vhosts.conf与httpd.conf进行区分,这样在httpd.conf中就可以只需要使用
<Directory "E:\www\trunk\admin">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
配置了apache服务器对部分文件目录的访问情况,然后在httpd-vhosts.conf中添加对该文件目录对应的url地址:
<VirtualHost *:80>
DocumentRoot "E:\www\trunk\admin"
ServerName dev.admin.local
Alias /scripts "E:\www\trunk\common\javascripts"
Alias /files "E:\www\trunk\files"
</VirtualHost>
用户就可以通过dev.admin.local访问这个目录了。
很多时候安装xdebug会出现异常,比如提示
这个时候对xdebug进行了一定的配置,同时在
就可使用xdebug了,不过这里尤其要注意的是,在xampp的php.ini配置文件中,有很多默认的值,需要用户进行调整,比如其中就有了默认的
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
; xdebug.remote_enable
; Type: boolean, Default value: 0
; This switch controls whether Xdebug should try to contact a debug client which is listening on the
; host and port as set with the settings xdebug.remote_host and xdebug.remote_port. If a connection
; can not be established the script will just continue as if this setting was Off.
xdebug.remote_enable = true
; xdebug.remote_handler
; Type: string, Default value: dbgp
; Can be either 'php3' which selects the old PHP 3 style debugger output, 'gdb' which enables the GDB
; like debugger interface or 'dbgp' - the brand new debugger protocol. The DBGp protocol is more
; widely supported by clients. See more information in the introduction for Remote Debugging.
xdebug.remote_handler = "dbgp"
; xdebug.remote_host
; Type: string, Default value: localhost
; Selects the host where the debug client is running, you can either use a host name or an IP
; address.
xdebug.remote_host = "localhost"
; xdebug.remote_log
; Type: string, Default value: none
; If set to a value, it is used as filename to a file to which all remote debugger communications are
; logged. The file is always opened in append-mode, and will therefore not be overwritten by default.
; There is no concurrency protection available.
xdebug.remote_log = "none"
; xdebug.remote_mode
; Type: string, Default value: req
;
; Selects when a debug connection is initiated. This setting can have two different values:
;
; req
; Xdebug will try to connect to the debug client as soon as the script starts.
; jit
; Xdebug will only try to connect to the debug client as soon as an error condition occurs.
;xdebug.remote_mode = "req"
; xdebug.remote_port
; Type: integer, Default value: 9000
; The port to which Xdebug tries to connect on the remote host. Port 9000 is the default for both the
; client and the bundled debugclient. As many clients use this port number, it is best to leave this
; setting unchanged.
xdebug.remote_port = 9000
对于前面使用;进行注释的行,需要取消注释,然后使得服务器能够正常的使用PHP。为了了解xdebug的真正功能,可以参考下面的英文文章,
正如我以前在调试代码的时候,总是喜欢使用print_r();exit();这样有个不好的地方在于,如果你在线上进行修改,这样使用xdebug,就很容易
出现外界用户在访问的时候,有自己的调试代码。而我通过xdebug来进行处理的时候,就避免了这个问题。
调试的效果图如下:
如果不会,可以参考我上次谈到的关于Zend studio的火狐浏览器插件。