由於使用了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的Firefox瀏覽器外掛程式。
http://www.cnblogs.com/yeer/archive/2010/04/07/1706407.html