mac eclipse 設定php debugger
設定php debug 有兩種
第一種是zender debug
第二種是xdebug
第一步就是要設定PHP Executable
原本習慣是用eclipse 的zend debug 可是每次重新安裝Executable
要執行PHP RUN CLI Application時 都會出現
"The Session Could Not Be Started, in order to generate debug information, please makw sure that the debugger is properly configured as a php.ini directive."
搞了很久才搞好 但是不久又忘記怎樣搞定的
但如今我發現另外一種方法
就是安裝MAMP
然後用MAMP的xDebug
步驟
1安裝MAMP 詳細不說
2修改php.ini 把 ( /Applications/MAMP/conf/php5.3 )下的php.ini打開,拉到最下面啟動xdebug 參考網路大大說法如下The problem was in my MAMP php.ini ( /Applications/MAMP/conf/php5.3 ). It turns out I needed to remove the ";" semi-colon from the beginning of the line with the path to xdebug.so.
Incorrect:
[xdebug] ;zend_extension="/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
Correct:
[xdebug] zend_extension="/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
(http://stackoverflow.com/questions/5917735/eclipse-php-error-trying-to-run-code
)
簡單的說 就是去掉分號
3在PHP Executable 新增一個
參考
NAME:MAMP5.3
Executable path:/Applications/MAMP/bin/php/php5.3.20/bin/php
PHP ini file:/Applications/MAMP/bin/php/php5.3.20/conf/php.ini
SAPI Type:CGI
PHP debugger:XDebug
在Debug指定這個設定後, 並把Enable CLI Debug 打勾
這將就可以了
我自己亂試的結論 有錯誤請指教 不要讓我一直誤導大家 謝謝
至於Zend Debug 設定法 忘記了 想不起來 想到再補上
Zend Debug 設定法
在/Applications/eclipse/plugins/org.zend.php.debug.debugger.macosx_5.3.18.v20110322/resources/php53/php.ini
加上
mysql.default_socket = /Applications/MAMP/tmp/mysql/mysql.sock
mysqli.default_socket = /Applications/MAMP/tmp/mysql/mysql.sock
zend_extension=./ZendDebugger.so
2013.07.01
今天終於發現為何Eclipse 設定Zend Debugger 總是啓動socket失敗原因了
那就是MAC OS 升級到10.8之後 才有的問題
解決方法就是把
/usr/lib/libexslt.0.dylib 下的libxslt.1.dylib 複製到Eclipse的plugins下的bin資料夾中 覆蓋原本的libxslt.1.dylib
我的Eclipse的plugins下的bin路徑如下 依每個人安裝的方式路徑會有不同
/Applications/eclipse/plugins/org.zend.php.debug.debugger.macosx_5.3.18.v20110322/resources/bin/
參考網址
http://chibakuma.com/blog/?cat=14
http://www.andrew-kirkpatrick.com/2012/07/apache-not-starting-in-zend-server-with-mac-os-x-10-8-mountain-lion-upgrade/
http://stackoverflow.com/questions/11875477/zend-studio-9-error-using-built-in-debugger-mac-os-10-8
網路的說法是
Finally figured this out. It was an incompatibility with OSX Mountain Lion. When I was able to get the Zend Studio console to show the actual internal error message, I found that the same problem existed for Zend Server (which I think Zend fixed there).
The same problem in Zend Server is described here: http://www.andrew-kirkpatrick.com/2012/07/apache-not-starting-in-zend-server-with-mac-os-x-10-8-mountain-lion-upgrade/The command you have to run for Zend Studio instead of Zend Server is a little different because the internal version of PHP is buried deep within the Zend Studio file structure. Instead of the one in the link, it's this:
sudo cp /usr/lib/libxslt.1.dylib /Applications/Zend\ Studio.app/Contents/Resources/Java/plugins/com.zend.php.debug.debugger.macosx_5.3.18.v20120625/resources/lib/.
Hope this helps someone.