How to enable xdebug for PHP 7.0 in AMPPS 3.7

Submitted by luxian on Thu, 10/12/2017 - 00:23

AMPPS is a great, but it lacks xdebug support. If you run the latest AMPPS version 3.7 on OS X you probably don't have the xdebug extension in the php-7.0/lib/extension folder.

To enable it you have to the following:

1. Select the PHP version you want to run via AMPPS GUI (in my case was PHP 7.0)

2. Make sure you use AMPPS' PHP binary inside terminal by running the following command

ls -l `which php`

The output should be something like:

/Applications/AMPPS/php/bin/php

If not try to run this:

export PATH="/Applications/AMPPS/php/bin:$PATH"

Try to run the previous command again and the path you see should be the one inside AMPPS directory.

3. Copy the phpinfo() output from localhost/cgi-bin/phpinfo.cgi

4. Download the right xdebug version you need from xdebug.org/wizard.php (you will have to paste the page text copied at step 1)

5. Untar/unzip xdebug files. - I used Zipeg, but should work  with tar command in the terminal as well

7.  Inside the folder with the xdebug files start running the command recommended by xdebug download page. First command to run is:

phpize

8. Second command requires some custom parameters to make it compatible with AMPPS (see Issues with enabling Xdebug on AMPPS)

./configure --enable-xdebug CC="gcc -arch i386" CXX="g++ -arch i386"

7.  Third command will be simple: 

make

8. Copy files to AMPPS:

cp modules/* /Applications/AMPPS/php/lib/extensions/

8. Enable xdebug inside php.ini by un-commenting this line inside the php.ini (make sure you adjust paths for different versions if needed):

Open /Applications/AMPPS/conf/php-7.0.ini and un-comment this line to look like this:

zend_extension = "{$path}/php-7.0/lib/extensions/ext/xdebug.so"

If needed, also add other xdebug settings to both files. For example I added the one recommended for PhpStorm (without the profiler and without port number since I'm using default):

[Xdebug]
xdebug.remote_enable=1

9. Restart apache using AMPPS GUI and enjoy.

 

Comments

Lennart (not verified)

Mon, 12/25/2017 - 22:34

Thank you very much for this. I always have a hard time setting up xdebug, but I just followed the steps and it worked. Great!

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.