Installing PHP 7.2 on Debian 9
The following steps describe how to install PHP 7.2 using the Ondrej Sury repository.
- First, update the
apt
package list and install the dependencies necessary to add a new repository over HTTPS:sudo apt updatesudo apt install apt-transport-https ca-certificates curl software-properties-common
- Start by importing the repository’s GPG key using the following curl command:
curl -fsSL https://packages.sury.org/php/apt.gpg | sudo apt-key add -
Add the ondrej’s repository to your system’s software repository list by typing:sudo add-apt-repository "deb https://packages.sury.org/php/ $(lsb_release -cs) main"
- Now that we have the ondrej’s repository enabled on our system, we can install PHP by specifying the version we want to use:
sudo apt updatesudo apt install php7.2-common php7.2-cli
- Verify the installation, by running the following command which will print the PHP version.
php -v
PHP 7.2.8-1+0~20180725124257.2+stretch~1.gbp571e56 (cli) (built: Jul 25 2018 12:43:00) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.8-1+0~20180725124257.2+stretch~1.gbp571e56, Copyright (c) 1999-2018, by Zend Technologies
Configuring Apache to run PHP
If you are using Apache as your web server to install PHP and Apache PHP module run the following command:
sudo apt install php7.2 libapache2-mod-php
Once the packages are installed to enable the php7.2 module just restart the Apache service:
sudo systemctl restart apache2
No hay comentarios:
Publicar un comentario