apt-get install apache2<\/pre>\nAfter the installation is complete, you should enable Apache to start automatically upon server boot with:<\/p>\n
systemctl enable apache2<\/pre>\nYou can also check the status of your Apache service with the following command:<\/p>\n
systemctl status apache2<\/pre>\nOutput:<\/p>\n
\u25cf apache2.service - The Apache HTTP Server\r\n Loaded: loaded (\/lib\/systemd\/system\/apache2.service; disabled; vendor preset: enabled)\r\n Active: active (running) since Wed 2019-08-07 03:34:36 CDT; 3min 47s ago\r\n Main PID: 429 (apache2)\r\n CGroup: \/system.slice\/apache2.service\r\n \u251c\u2500429 \/usr\/sbin\/apache2 -k start\r\n \u2514\u2500430 \/usr\/sbin\/apache2 -k start\r\n<\/pre>\n<\/span>Step 3: Install PHP 7.2<\/span><\/h2>\nPHP 7.2 is not available through the Debian built-in repositories, so we will use a third-party repo instead. If you already have PHP 7.2, you can skip this step.<\/em> PHP 7.2 can be installed using a third-party repo. To do this, install the \u2018software-properties-common\u2019 and few other packages\u00a0packages:<\/p>\napt-get install software-properties-common apt-transport-https lsb-release ca-certificates<\/pre>\nThen, add the repo and update your sources:<\/p>\n
wget -O \/etc\/apt\/trusted.gpg.d\/php.gpg https:\/\/packages.sury.org\/php\/apt.gpg\r\necho \"deb https:\/\/packages.sury.org\/php\/ $(lsb_release -sc) main\" > \/etc\/apt\/sources.list.d\/php.list\r\napt-get update<\/pre>\nFinally, install PHP 7.2 using the following command:<\/p>\n
apt-get install php7.2 php7.2-cli php7.2-common<\/pre>\nTo install the required PHP 7.2 extensions, you can use the following command:<\/p>\n
apt-get install php7.2-mbstring php7.2-gd php7.2-json php7.2-intl php7.2-curl php7.2-xml php7.2-zip<\/pre>\nUse the following command to check the PHP version currently installed on your server:<\/p>\n
php -v<\/pre>\nYou should receive the following output:<\/p>\n
PHP 7.2.20-2+0~20190725.24+debian9~1.gbp69697c (cli) (built: Jul 25 2019 11:53:56) ( NTS )\r\nCopyright (c) 1997-2018 The PHP Group\r\nZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies\r\nwith Zend OPcache v7.2.20-2+0~20190725.24+debian9~1.gbp69697c, Copyright (c) 1999-2018, by Zend Technologies<\/pre>\nDisable PHP 7.0 in Apache and enable PHP 7.2:<\/p>\n
a2dismod php7.0\r\na2enmod php7.2<\/pre>\nAlso, enable the mod_rewrite module in Apache if it is not enabled yet:<\/p>\n
a2enmod rewrite<\/pre>\nThen, restart Apache2 for the changes to take effect:<\/p>\n
service apache2 restart<\/pre>\n