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:
- Install it from https://launchpad.net/~ondrej/+archive/ubuntu/php5-5.6
- 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!
-
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 -
Go to the directory with the source of Apache. (
cd ~/web-server/apache2
in your terminal). -
Execute this command in the terminal
./configure --enable-so
-
Execute
sudo make
andsudo 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.
- If you didn’t install the packages which I asked to install in “Compiling Apache” - please install it.
- Go to the directory with the source of PHP.
- 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
). - Execute
sudo make
andsudo make install
. PHP will be placed into/usr/local/lib/php/
(again - you can change this directory, see./configure --help
) - 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
) - 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. - Add this to the end of your httpd.conf:
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
##The final step: configuring and installing Xdebug.
- Go to the directory with the source of XDebug
- Execute
./configure && sudo make
- Execute
sudo cp modules/xdebug.so /usr/local/lib/php/extensions/xdebug-ext/
- 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
- Go to the terminal, execute
php -i
and copy the output of this command. - Go to http://xdebug.org/wizard.php, past the output and press the button.
- Follow the steps you see after pressing the button “Analyse my phpinfo() output”
In Komodo go to Preferences - Languages - PHP
.
- Set the interpreter:
/usr/local/bin/php
- 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.