设为首页 收藏本站
查看: 870|回复: 0

[经验分享] xdebug with XAMPP on Mac OS X

[复制链接]

尚未签到

发表于 2015-12-30 10:34:15 | 显示全部楼层 |阅读模式
  源blog地址http://blog.laaz.org/tech/2010/08/27/xdebug-with-xampp-on-mac-os-x/
  
  I just upgraded my XAMPP to latest release and found myself trapped with no memory of how to install xdebug on a Mac with XAMPP.

0. Install Xcode and autoconf
  Thanks to Cedric Talbot for commenting and pointing out that I had not noticed I had all the needed developer tools already in place from all the development I do on my Mac. According to Cedric’s experience, you’ll need to have at least Autoconf installed via MacPorts or Homebrew and that in turn will require you to install Xcode. Once you have Xcode installed, go to Xcode prefs -> Downloads pane and install ‘Xcode command line tools’ and when that is done, open terminal and enter:




sudo xcode-select -switch /Applications/Xcode.app
  This will set the folder where the Xcode is installed so that all the command line tools find it. Now continue with Macports or Homebrew to install autoconf.

1. Install XAMPP Developer package
  Building xdebug requires you to have php headers, so download and install corresponding developer package for XAMPP.

2. Download xdebug
  Download xdebug source from here or checkout from GIT:




git clone git://github.com/derickr/xdebug.git
cd xdebug

3. PHPIZE
  Run phpize




/Applications/XAMPP/xamppfiles/bin/phpize

4. Configure xdebug
  Recent XAMPP (mine was 1.8.3-2) are built 64bit and so the configure is rather simple:




./configure --enable-xdebug \
--with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config
  If your XAMPP is built for i386 (32-bit) architecture, you have to modify default build flags, which otherwise would build for x86_64 (64-bit):




./configure --enable-xdebug \
--with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config \
CFLAGS="-arch i386 $CFLAGS" CCFLAGS="-arch i386 $CCFLAGS" \
CXXFLAGS="-arch i386 $CXXFLAGS" LDFLAGS="-arch i386 $LDFLAGS"
  edit: configure command updated to append variables instead of prepending them (thanks Sequan).
  edit2: Alternatively, as suggested by Junaid below, on a Lion you could use the following command (haven’t tried it myself), which is essentially the same, only providing architecture as direct argument to compiler instead of setting it in FLAGS:




./configure --enable-xdebug CC="gcc -arch i386" CXX="g++ -arch i386"
  edit3: If, for some unknown reason, you still don’t get the correct architecture, you can manually edit the Makefile and fix the compile flags yourself. The screenshot shows the only 3 differences in resulting Makefile if I ran the ./configure command without (64-bit, left) and with (32-bit, right) the FLAGS settings:
DSC0000.png
  Just open the Makefile in your favorite text editor and adjust the flags directly.

5. Make




make
  When the compilation finishes, you can verify that the module was built 32-bit, by running:

> lipo -info modules/xdebug.so
Non-fat file: modules/xdebug.so is architecture: i386

  The architecture should be reported as i386. When you get x86_64, then your configure didn’t succeed in setting the architecture and you should revert to step 4.

6. Copy files
  Copy the files to PHP extensions directory. You might need to adjust the path for your XAMPP and PHP version:




sudo cp modules/* /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/

7. Configure PHP.ini
  Final step is to configure php.ini file. So open /Applications/XAMPP/etc/php.ini with your favorite editor and add the lines to the bottom of it:




[xdebug]
zend_extension=/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
  EDIT: As pointed out by strah below, if you’re going to use MacGDBp for debugging GUI, you need to add additional line to php.ini file:




xdebug.remote_autostart=1
  So that debbugger is connected on every page load.
  NOTE: this is not reccommended in production environments as it degrades performance! Now restart Apache and you should be good to go.
  




Be Sociable, Share!

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-158243-1-1.html 上篇帖子: QQ for Mac OS X : QQ表情管理插件 下篇帖子: ArcGIS Runtime SDK for Mac OS X使用示例
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表