Skip to main content

Installing php 7.0.5 on debian

While some put php 5.3 , getting it out of the grave, I decided not to lag behind the whole planet, where the sites are translated to the seventh version of php, which is so much praised on the Internet, including high speed, and installed it from the DotDeb repository today. I must say, the increase in speed is really noticeable. My websites and WordPress, and MODX began to fly yet. :) That's how I did the migration.

The content of the article:

Php packages from the Dotdeb repository

The chip of php 7 packages from this repository is that they are called php7.0-% packagename% . That is, you can immediately have on the server both php 5.6 from the Debian repository and the seventh version. And the configuration files are not mixed up, since the packages from dotdeb store them in the /etc/php/7.0/ directory and / etc / php / mods-available / for modules.

If you wish, you can familiarize yourself with the Dotdeb site, but it is in English.

Download gpg repository key.

  # wget 

We register the repositories in the file in the /etc/apt/sources.list.d/dotdeb.list directory.

  # echo -e "deb jessie all \ ndeb-src jessie all"> /etc/apt/sources.list.d/dotdeb.list 

Update the package cache.

  # aptitude update 

Next, we look at what we need to install. For example, your server is based on php-fpm. Ok, we put it:

  # aptitude install php7.0-fpm 

If php is like apache module, then so:

  # aptitude install php7.0 libapache2-mod-php7.0 

And the rest of the packages, to taste.

  # aptitude install php7.0-mysql php7.0-curl php7.0-redis php7.0-gd 

If you install everything from scratch, then the following steps, after installation, can be found in the appropriate instructions:

Remove php5 from server

If you set up a server not from scratch, but already with working sites, then after migrating to php 7, you may want to remove the fifth version altogether from the server. First you need to know the list of installed php5 packages:

  # dpkg -l |  grep php5 |  grep -w 5 |  awk '{print $ 2}' 

Then first remove the modules.

  # aptitude purge php5-memcached php5-redis php5-curl 

And, then, the basis:

  # aptitude purge php5-fpm php5-common 

This is necessary to prevent an error, when php5-common is first removed, and dpkg, when removing a module, tries to disable it with the command php5dismod, but it does not work. As a result, the package breaks and is not removed. I had this situation with the php5-memcached module when I deleted all php packages at once. :)


To see firsthand the speed of work, I launched a spherical benchmark in a vacuum. The subjective results of his work also pleasantly surprised. Run on exactly the same parameters. Only different versions of php.

PHP 5.6, shipped from Jessie repositories

 Start: 2016-04-25 12:01:06
 PHP version: 5.6.19-0 + deb8u1
 Platform: Linux
 test_math: 1.953 sec.
 test_stringmanipulation: 1.939 sec.
 test_loops: 1.149 sec.
 test_ifelse: 0.834 sec.
 Total time:: 5.875 sec. 

PHP 7.0.5 supplied from dotdeb repository

 Start: 2016-04-25 11:59:53
 PHP version: 7.0.5-1 ~ dotdeb + 8.1
 Platform: Linux
 test_ifelse: 0.417 sec.
 test_loops: 0.556 sec.
 test_stringmanipulation: 0.767 sec.
 test_math: 0.554 sec.
 Total time:: 2.294 sec. 

Not bad? Very much. WordPress, which originally produced a generation rate of approximately 0.160-0.220, began to generate pages in approximately 0.06-0.100 ms. And it is on inexpensive vds-ke with hdd. And what else is needed for happiness? :)

How do you rate the article?
Звёзд: 1Звёзд: 2Звёзд: 3Звёзд: 4Звёзд: 5 ( 3 ratings, average: 5.00 out of 5)

” Comment “ Installing php 7.0.5 on Debian

Add a comment

Your email will not be published.