Compile and debug the PHP tool xdebug on Mac

Source: Internet
Author: User

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

It looks complicated. You need to compile the xdebug sourcecode before installing it.

The solution is a combination of xdebug and
Macgdbp.

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
PHP 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
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 Entropy
PHP. 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 is

Leopard: PhP 5.2.5 release 6 beta

The binary distribution of xdebug from ActiveState which I was using previusly won't work with this version
PHP (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 = OnAnd
error_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
    OSX ):/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 shoshould show up along with a whole bunch of Directives

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.