Install Php 7.1 Debian 8



Install Php 7.1 Debian 8

PHP 8.0 brings several new features and improvements in performance, syntax, security, and stability. Installing PHP 8.0 on just about any sort of server/development setup is made easy with pre-compiled packages available in all currently supported Debian and Ubuntu versions.

7.- Install PHP 7.3 on Debian 9. Next, we can show the PHP version installed and it should be 7.3.:# php -v. 8.- PHP version. Test if PHP is working. Now it is time to test PHP. If you already have Apache or any HTTP server installed, just restart it. We will take Apache as a reference.:# systemctl restart apache2. However, if Apache is.

Extensions and Dependency Changes in PHP 8.0

Despite the massive amount of changes, there are not many changes in PHP 8.0 in its dependencies and extension structure.

  1. This tutorial shows how to build the new PHP 7.1 as a PHP-FPM and a FastCGI version on a Debian Jessie server. This PHP 7.1 build includes many compiled in extensions and Zend OPcache and Memcached as loadable modules. 1 Preliminary Note. I will install PHP 7.1 which has been released as final version a few days ago.
  2. If someone else (like me) still needs to install php 7.1 or newer on Debian 7.X (wheezy), please be informed that I followed this instruction (just scroll down to Configuration for Debian 7.x “Wheezy” section) and it worked for me like a charm!
  3. Set PHP 7.1 Version in Ubuntu. To set the PHP version that will work with Apache web server, use the commands below. First disable the current version with the a2dismod command and then enable the one you want with the a2enmod command. $ sudo a2dismod php7.0 $ sudo a2enmod php7.1 $ sudo systemctl restart apache2.
  4. Install/remove additional PHP versions using the component name from step 2. Example of the command to install PHP 7.4: Note: PHP 7.4 is available starting from Plesk Obsidian 18.0.21 Update 4. For Linux: # plesk installer add -components php7.4. For Windows Server: C: plesk installer add -components php74 Example of the command to remove.
  1. JSON extension is now always available, and there is no compile flag to exclude it. This means there is no need to explicitly install php-json packages anymore.
  2. xmlrpc extension is moved to PECL with good reasons. Software repositories mentioned in this post does not include xmlrpc extension for PHP 8.0.

In addition, the GD extension has its name changed from php_gd2.dll to php_gd.dll in Windows that will be covered in a separate article.

INI changes in PHP 8.0

There are few INI file changes as well.

  1. Assertions throw exceptions by default - (assert.exception=1)
  2. Default error display is set to E_ALL - (error_reporting=-1)
  3. Startup errors are displayed by default - (display_startup_errors=1)

Due to new features and changes in PHP 8.0,

  • The new JIT feature in PHP 8.0 adds several new INI directives.
  • zend.exception_string_param_max_len INI setting due to Configurable exception stack trace string length

Installing PHP 8.0 on Ubuntu and Debian is made easy by the great efforts of Ondřej Surý. He maintains a PHP PPA that contains PHP 8.0 and several popular PECL extensions ready to install on any current Debian/Ubuntu system.

1. List existing PHP packages

If you are updating from an existing PHP version to 8.0, it's important to get a list of existing PHP packages. Albeit the small extension changes, installing the PHP 8.0 counterpart packages is the easiest way to make sure the upgrade is smooth and covers the same packages from the current PHP version.

Install Php 7.1 Debian 8gb

This command will list all the packages containing name php, and writes it to a file named packages.txt, which can be referred anytime.

2. Add ondrej/php PPA

Ubuntu

Debian

Steps above will add the PPA as a source of packages, that contains all PHP packages and their dependencies such as argon2 and libzip.

3. Install PHP 8.0 and extensions

All PHP 8.0 packages follow php8.0-NAME pattern, and php8.0-common package includes a sensible set default of extensions (such as `php8.0-).

Install PHP 8.0 with CLI

This command will install several PHP extensions due to php8.0-common, and the CLI for PHP 8.0.

You can confirm the installation by running:

Additional extensions

You can install additional extensions from the same php8.0-NAME pattern. Refer to the packages.txt file to see a list of existing packages if you are upgrading an existing system.

Note that you do not need to install php8.0-json as it is now included by default.

An example to install a few more useful extensions:

For development environments, code coverage tools or the Xdebug debugger can be installed as well.

Install Server APIs

Depending on the web server you use, you will need to install additional packages to integrate with the web server.

For Apache using mpm_event, Nginx, Litespeed, etc., php8.0-fpm package provides integration with PHP 8.0 via FPM.

For Apache using mod_php, install libapache2-mod-php8.0.

Note that the Apache2Handler is renamed to php_module from php7_module in PHP 8.0. The libapache2-mod-php8.0 package automatically configures the Apache module location, but if you are updating from an existing PHP setup, you might need to update configuration files; in particularly <IfModule> blocks.

4. Test PHP 8.0 installation

To test the PHP installation and the extensions, run the following commands:

Purge old PHP versions

If the new installation is working as expected, you can remove the old PHP packages from the system.

This assumes you are using PHP 7.4 as the previous version. Change php7.4 part of the command above with the appropriate PHP version.

Running PHP 8.0 with Other Versions

Instead of removing old PHP versions, it is also possible to run multiple PHP versions side-by-side.

Install Latest Php Debian

The PHP 8.0 CLI will be installed at /usr/bin/php8.0 location by default. Similarly, other PHP binary files will be located in the same directory (/usr/bin/php7.4, /usr/bin/php7.3, etc). The default php name will be symlinked to the latest PHP version by default, but it is possible to change where the default php command links to.

The update-alternatives command provides an easy way to switch between PHP versions for PHP CLI.

This brings up a prompt to interactively select the alternative PHP binary path that php points to.

Apt Install Php Debian

To set the path without the interactive prompt:

Install Php On Debian 10

What's new and changed in PHP 8.0

For a complete list of changes in PHP 8.0, see What's new and changed in PHP 8.0

Debian Install Php 7.4

PHP 8 logo is by Vicent PONTIER. Debian and Ubuntu icons are from Strongicon and ProGlyphes.