標籤:
1.下載xdebug檔案
http://xdebug.org/wizard.php
將phpinfo()的原始碼複製到文字框中,xdebug會提示如何配置和下載哪個版本的xdebug。
全部:
http://www.xdebug.org/download.php
InstructionsDownload xdebug-2.3.3.tgzUnpack the downloaded file with tar -xvzf xdebug-2.3.3.tgzRun: cd xdebug-2.3.3Run: phpize (See the FAQ if you don‘t have phpize.As part of its output it should show:Configuring for:...Zend Module Api No: 20121212Zend Extension Api No: 220121212If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.Run: ./configureRun: makeRun: cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20121212Edit /etc/php.ini and add the linezend_extension = /usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.soRestart the webserver
在xdebug官網會有許多安裝提示。其中可能會出現的問題有:
phpize沒有安裝:繼而又要安裝brew,再安裝autoconf可謂一波三折
2.解決相關組件不全的問題
問題描述
Mac系統升級到10.9(mavericks)時安裝php擴充,執行 phpize 提示如下錯誤:
Cannot find autoconf. Please check your autoconf installation
and the $PHP_AUTOCONF environment variable.
解決辦法
先安裝Homebrew:
如果以下連結失效的話,可以到brew官網查看。http://brew.sh/
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
然後安裝 autoconf:
brew install autoconf
3.配置php.ini
在xdebug官網上的配置,只能夠正確配置好xdebug但是不能與phpstorm進行配置。在php.ini末尾加上如下代碼:
[xdebug]zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"xdebug.remote_enable = Onxdebug.remote_handler = "dbgp"xdebug.remote_host = "localhost"xdebug.remote_port = 9000xdebug.idekey = PHPSTROM
4.配置phpstorm
開啟phpStorm,
-進入File>Settings>PHP>Servers,這裡要填寫伺服器端的相關資訊,name填localhost,host填localhost,port填80,debugger選XDebug
-進入File>Settings>PHP>Debug,看到XDebug選項卡,port填9000,其他預設
-進入File>Settings>PHP>Debug>DBGp Proxy,IDE key 填 phpStorm,host 填localhost,port 填80
-點OK退出設定。
在phpStorm裡開啟監聽(電話按鈕)。
5.chrome的xdebug配置
在IDE key裡將其配置成“phpStorm”
項目地址:https://github.com/mac-cain13/xdebug-helper-for-chrome
好了,到此就可以配置完成了,有問題的話可以給我留言,大家一起交流。
6.其他:
重啟apache
sudo apachectl restart
修改php.ini許可權
sudo chmod 0777 php.ini
編輯php.ini檔案
sudo vi php.ini(修改i,退出:q,儲存退出:wq)
mac+php+xdebug+phpstorm在蘋果下配置xdebug一波三折