php調試備忘
來源:互聯網
上載者:User
php 調試配置其實很簡單,以下只是做一個備忘。
1.ide 使用eclipseForPHP。首先下載一個 php_xdebug-2.2.3-5.4-vc9.dll,並在php.ini裡面增加:
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable =1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000
xdebug.remote_mode = "req"
xdebug.auto_trace = On
xdebug.show_exception_trace = On
xdebug.remote_autostart = On
這樣就為php增加了調試功能。
2.在eclipseForPhp裡面的喜好設定裡面,首先在PHP Executable 裡面配置php.exe的位置和php.ini的位置,然後在php debuger處選擇xdebug。
這樣就把具有調試功能的php執行環境加到eclipseForPhp裡面來了。
3.在php-debug處首先在PHP Debuger處選擇 XDebug,然後在PHP Excutable處選擇在上一步配置的php執行環境。
這樣phpForEclipse就具有了調試php 指令碼的功能。調試時,選擇整個php項目右鍵,配置一個PHP Script配置,
RunTime PHP處 選中Alternate PHP,下拉框選擇之前配置的php執行環境,然後在PHP File處選擇要調試的php指令碼即可。
4.如果要進行PHP Web Page 調試,則需要在喜好設定的PHP Servers處配置一下預設的PHP Web Server,
Server 選項卡 中 選擇一個標識名稱,然後,在下面輸入訪問web root的 http 地址,(這裡需要特別注意一下,
一般在操作時,需要修改apache的httpd.conf檔案中的DocumentRoot 和 一個自訂的工作空間目錄(例如:E:/ws),讓apche執行E:/ws目錄下的項目,
例如有個 項目名稱是weixin,那麼這樣配置以後啟動apache後,我們需要通過http://localhost:8080/weixin來訪問這個項目,實際上訪問的是E:/ws
/weixin下面的php檔案。)
輸入的web root的 http 地址是類似:http://localhost:8080這樣的 ,然後在 Path Mappping選項卡裡面,輸入訪問該項目的具體的url路徑和該項目在工作空間的路徑位置,例如:Path On Server 是 http://localhost:8080/weiqin ,Path In WorkPlace 是 /weiqin,。
這樣,我們就可以使用 Web Page調試了。Web Page 調試時,右鍵項目,選擇Debug->PHP Web Page,增加一個新的配置。
Server Debugger 選擇XDebug,PHP Server選擇 Default PHP Web Server,然後在File 裡面 選擇要調試的檔案 即可調試了。