Official Debian packages contain PHP 5.4 at the moment. If you need higher version, you need to use 3rd-party repositories such as dotdeb. Generally it is recommended to use the official packages. However, sometimes there are reasons to use third party repositories. And this is one of them. Process of upgrade to PHP 5.6 on Debian 7 “Wheezy” is pretty simple and take just a few minutes.
We are going to use Dotdeb repository. It contain a lot up-to-date packages for debian servers such as nginx, php, mysql, redis etc. Note that Dotdeb supports Debian 8.x “Jessie”, Debian 7.x “Wheezy” and Debian 6.x “Squeeze”.
Upgrade Steps
1. Add the main repository to your /etc/apt/sources.list file
deb http://packages.dotdeb.org wheezy all deb-src http://packages.dotdeb.org wheezy all
2. If you want to install :
PHP 5.6 on Debian 7 “Wheezy” (without Zend thread safety):
deb http://packages.dotdeb.org wheezy-php56 all deb-src http://packages.dotdeb.org wheezy-php56 all
PHP 5.6 on Debian 7 “Wheezy” (with Zend thread safety):
deb http://packages.dotdeb.org wheezy-php56-zts all deb-src http://packages.dotdeb.org wheezy-php56-zts all
If you not sure about which version you need, you can check it by running phpinfo();
3. Fetch and install the GnuPG key
wget https://www.dotdeb.org/dotdeb.gpg sudo apt-key add dotdeb.gpg
4. Run sudo apt-get update
5. Run sudo apt-get install php5
upgrade to PHP 5.6 on Debian DONE
ENJOY 🙂
thankyou for links
Bullshit.
I followed the instructions and it installed php 5.4 (which is the one I already had, obviously).
Fucking waste of time.
Hi
Did you follow all the steps? There were no errors with dotdeb repository? As you can see dotdeb instructions for wheezy are the same – https://www.dotdeb.org/instructions/
It is rather old post, but I manage to install php5.6 following the instructions before posting this article.
thank you, solved my problem. god bless you.
You are welcome 🙂
Its works, but there is a problem
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20131226-zts/ncurses.so’ – /usr/lib/php5/20131226-zts/ncurses.so: cannot open shared object file: No such file or directory in Unknown on line 0
To solve this problem, install Ncurses manually.
# apt-get install php5-dev libncursesw5-dev php-pear
# pecl install ncurses
thank you, solved my problem.
Works! confirmed
Thanks, it work