Xdebug with XAMPP on Mac OS X

Source: Internet
Author: User
Tags zts

SOURCE Blog Address 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 about how to install Xdebug on a Mac with Xampp.

0. Install Xcode and autoconf

Thanks to Cedric Talbot-commenting and pointing out that I-had not noticed I-had all the needed developer tools Alread The development I does on my Mac. According to Cedric's experience, you'll need to has at least Autoconf installed via macports or Homebrew and so in Tur n would require you to install Xcode. Once You has Xcode installed, go to Xcode prefs-Downloads pane and install ' Xcode command line tools ' and when that is done, open terminal and enter:

/applications/xcode.app

This would set the folder where the Xcode is installed so, 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 has PHP headers, so download and install corresponding developer package for XAMPP.

2. Download Xdebug

Download Xdebug source from this or checkout from GIT:

git clone git://github.com/derickr/xdebug.gitcd xdebug   
3. PHPIZE

Run phpize

/applications/xampp/xamppfiles/bin/phpize   
4. Configure Xdebug

Recent XAMPP (mine was 1.8.3-2) were built 64bit and so, the Configure is rather simple:

.   --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"  "-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, in 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 I T in FLAGS:

.   cc=cxx="g++-arch i386"  

edit3: If, for some unknown reason, you still don ' t get the correct architecture, you can manually edit the M Akefile and fix the compile flags yourself. The screenshot shows the only 3 differences in resulting Makefile if I ran the ./configure command without (64-bi T, left) and with (32-bit, right) the FLAGS settings:

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 is built 32-bit, by running:

> lipo -info modules/xdebug.soNon-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 your 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:

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.soxdebug.remote_enable< Span style= "color: #000066; Font-weight:bold; " >=onxdebug.remote_handler=dbgpxdebug.remote_host==            

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.in I file:

Xdebug.remote_autostart=1 

So, Debbugger is connected on every page load.

Note: This isn't reccommended in production environments as it degrades performance! Now restart Apache and you should is good to go.

Be sociable, share!

Xdebug with XAMPP on Mac OS X

Related Article

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.