Install Apache2, PHP5.6 and Xdebug and configure it for Komodo Debugging (Linux - Debian/Ubuntu)

In most Linux distros there is no PHP 5.6 release atm. So if you want to use PHP 5.6 you have to compile it yourself and re-compile Apache to add a PHP 5.6 support.

So there are 2 ways I know to install PHP 5.6 in your Linux:

  1. Install it from https://launchpad.net/~ondrej/+archive/ubuntu/php5-5.6
  2. Download the source of PHP, XDebug and Apache and compile it.

The first way is what I recommend to do if you never works with Linux (or works a bit but actually doesn’t know a lot about compiling and terminal).

The second way is harder than the first way so you should know some basics of working with Terminal in Linux distros.

This guide can be different for the distros which I not mentioned.

First step: you should download the latest PHP 5.6 release from php.net

Next extract the source to a folder (in my case: ~/web-server/php56/)

Now you should download the source of Apache2 from httpd.apache.org (I’m downloaded Apache 2.4 - the latest release atm)

You should extract it to the same directory (in my case: ~/web-server/apache2/), but it’s not so important, it’s just convenient.

So now download the Xdebug source from xdebug.org

Extract the source to the same directory (in my case: ~/web-server/xdebug/) (I’m already said why you should do that ;))

##Compiling Apache!

  1. Install this packages:
    autoconf: 2.59+
    automake: 1.4+
    libtool: 1.4.x+ (but NOT 1.4.2!)
    re2c: 0.13.4+
    bison: 1.28 (recommended), 1.35 or 1.75

  2. Go to the directory with the source of Apache. (cd ~/web-server/apache2 in your terminal).

  3. Execute this command in the terminal ./configure --enable-so

  4. Execute sudo make and sudo make install. When it’s done Apache will be placed into /usr/local/apache2/ (by default, you can change it to your own directory, just look at available options of ./configure by executing ./configure --help)

##Compiling PHP.

  1. If you didn’t install the packages which I asked to install in “Compiling Apache” - please install it.
  2. Go to the directory with the source of PHP.
  3. Execute ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli (if you want to compile php with PDO supporting - see ./configure --help).
  4. Execute sudo make and sudo make install. PHP will be placed into /usr/local/lib/php/ (again - you can change this directory, see ./configure --help)
  5. Copy php.ini-development from the folder with the source to /usr/local/lib/php.ini (sudo cp php.ini-development /usr/local/lib/php.ini)
  6. Open httpd.conf (placed in /usr/local/apache2/conf/) and check if this line exists: LoadModule php5_module modules/libphp5.so. If they aren’t - add it.
  7. Add this to the end of your httpd.conf:
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

##The final step: configuring and installing Xdebug.

  1. Go to the directory with the source of XDebug
  2. Execute ./configure && sudo make
  3. Execute sudo cp modules/xdebug.so /usr/local/lib/php/extensions/xdebug-ext/
  4. Open php.ini and past this line to the end of the file: zend_extension = /usr/local/lib/php/extensions/xdebug-ext/xdebug.so

OR

  1. Go to the terminal, execute php -i and copy the output of this command.
  2. Go to http://xdebug.org/wizard.php, past the output and press the button.
  3. Follow the steps you see after pressing the button “Analyse my phpinfo() output”

In Komodo go to Preferences - Languages - PHP.

  1. Set the interpreter: /usr/local/bin/php
  2. Set the php.ini: /usr/local/lib/php.ini.

Note: since Komodo 9 PHP 5.6 is a default PHP interpreter for Komodo PHP Debugging. So you able to skip changing the interpreter and php.ini for Komodo but if you debugging an applications which uses MySQL - you have to change php.ini to your configured for MySQL php.ini

Note 2: I edited this topic a lot because I wrote it when my English was very terrible. Now it should looks better than older version. If you find any mistakes/errors or faced with a problems while following this guide - please notice me about that in this topic by @mentioning me.

2 Likes

Thanks for sharing defman. Would you mind adding a small disclaimer at the start of your post explaining why you are compiling apache, php and xdebug from source rather than installing them using apt?

In repositories there is no PHP5.6.0 at the moment of creating topic and if you want to use PHP5.6 - you must recompile Apache and Xdebug for PHP5.6.0 using.
I’m add this to first topic.

Fwiw this type of stuff is usually handled in third party repo’s, eg. https://launchpad.net/~ondrej/+archive/ubuntu/php5-5.6

But not in official repo and only for Ubuntu. My guide works in Ubuntu and Debian :3

Sure - “fwiw” means “for what its worth”, meaning you can take it as you want (or dismiss it entirely) :wink:

With you I can learn a lot of English abbreviations :smiley:

HI, Defman. How I contact with you? I need your help in install php 5.6. Thanks.

Skype: defman21
Oops, forgot about facebook and twitter:


http://twitter.com/_defman
But please understand - I’m from Russia and my English isn’t so good :wink:

If somebody don’t know how to install PHP5.6 and xdebug in Windows - I can write a guide :wink:

Updated the content. I hope now it looks much better. Also I added the repository given by @nathanr and 2 notes: one of them is about Komodo 9 and PHP 5.6 - http://komodoide.com/blog/2015-02/komodo-9-rc-release-now-available/