mac+php+xdebug+phpstorm在蘋果下配置xdebug一波三折

1.下載xdebug文件php

http://xdebug.org/wizard.phpgit

將phpinfo()的源代碼複製到文本框中,xdebug會提示如何配置和下載哪一個版本的xdebug。github

所有下載地址:web

http://www.xdebug.org/download.phpchrome

Instructions

Download xdebug-2.3.3.tgz
Unpack the downloaded file with tar -xvzf xdebug-2.3.3.tgz
Run: cd xdebug-2.3.3
Run: phpize (See the FAQ if you don't have phpize.

As part of its output it should show:

Configuring for:
...
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.

Run: ./configure
Run: make
Run: cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20121212
Edit /etc/php.ini and add the line
zend_extension = /usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
Restart the webserver

在xdebug官網會有許多安裝提示。其中可能會出現的問題有:apache

phpize沒有安裝:繼而又要安裝brew,再安裝autoconf可謂一波三折ruby

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.inicurl

在xdebug官網上的配置,只可以正確配置好xdebug可是不能與phpstorm進行配置。在php.ini末尾加上以下代碼:phpstorm

[xdebug]
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
xdebug.remote_enable = On
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000
xdebug.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)

相關文章
相關標籤/搜索