在mac编译调试php的工具xdebug

本文详细介绍了如何为 PHP 5.2.5 (Entropy.ch 构建) 在 OSX 10.5 上从源代码编译并安装 Xdebug 2.0.2 的过程。包括配置 CFLAGS 设置以支持 x86_64 位架构,使用 phpize 工具,以及如何在 php.ini 中启用 Xdebug。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Compiling & installing Xdebug for PHP 5.2.5 (Entropy.ch build) on OS X 10.5

http://alexander.kirk.at/2008/12/26/debugging-php-on-mac-os-x/

http://www.designified.com/blog/article/60/compiling-installing-xdebug-for-php-525-entropych-build-on-os-x-105

看起来很复杂,要自己编译xdebug的sourcecode,然后才能安装

The solution is a combination of Xdebug andMacGDBp.

macgdbp-debugger

Following on from my previous post detailing Installing Xdebug for PHP (Entropy.ch build) on OS X, this post deals with compiling and installing xdebug 2.0.2 forPHP Version 5.2.5 (www.entropy.ch Release 6) on OS X 10.5.2 Mac Pro 64-bit (2 x Quad-Core Intel Xeon).

The instructions below are a composite of those in the Xdebug README and the user ‘pilif/Philip’ on the entropy forums who posted the CFLAGS settings used to compile Xdebug for x86 64bit architecture (see the post here – thanks Philip!)

The standard release of Marc Liyanage’s PHP Apache Module may not work under OS X 10.5, depending on the architecture of the processor – you will know if you get the error message “The following install step failed: run postflight script for EntropyPHP. Contact the software… “.

Marc has been hard at work compiling an updated 4-way binary and trying to get all the dependencies and packages working – the latest version which I am using (works fine) and which this tutorial is based on isLeopard:PHP 5.2.5 Release 6 BETA

The binary distribution of Xdebug from Activestate which I was using  previously won’t work with this version ofPHP (I believe I am right in saying it will only work on a 32bit architecture but I may be well wrong) so it needs to be complied from source – luckily it’s pretty easy to do!

First off we need to make sure PHP 5.2.5 from the Entropy site is installed and working, and that the install directory is /usr/local/php5/

Next we need to make sure it is using a php.ini file (probably located at /usr/local/php5/lib/php.ini – if not make a copy of the ‘php.ini-recommended’ file and rename it ‘php.ini’).

We need to make sure that errors are set to be displayed in the ini file (display_errors = On anderror_reporting  =  E_ALL).

The OS X developer tools must be installed (either from the Leopard install disk or the disks which came with the computer).

  1. Run a phpinfo() page up on the local web server and find the ‘extension_dir’ entry (in the Configuration ->PHP Core section) – copy that value down (it will be something like /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/)
  2. Download the source code from http://xdebug.org/
  3. In the terminal, cd into the directory which the source code tar file is in
  4. Unpack the tarball: tar -xzf xdebug-2.0.2.tgz
  5. cd into the unpacked directory: cd xdebug-2.0.2
  6. Run phpize (using the phpize installed with the Entropy distribution, not the one installed byOSX):/usr/local/php5/bin/phpize
  7. Configure: CFLAGS='-arch x86_64' ./configure --enable-xdebug
  8. Run make: make
  9. Copy the compiled module to the directory you determined in step 1 (replacing the directory shown here with your one if it is differant):cp modules/xdebug.so /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/


Open your php.ini file (for the Entropy version it is at /usr/local/php5/lib/php.ini) and add the following:

[xdebug]
zend_extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so

(obviously substitute your extensions directory path from stage 1 if it isn’t the same as mine)

  1. Restart the web server
  2. Reload the phpinfo() page and look for the ‘Xdebug’ section – if all is working it should show up along with a whole bunch of directives

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值