Installing Laravel 9 with php 8.1 and Apache2 using Ubuntu 22

Connect to your ubuntu instance.

1. Install Apache

sudo apt update
sudo apt install apache2
sudo systemctl status apache2

2. Install PHP 8.1

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt install php8.1 libapache2-mod-php8.1
sudo systemctl restart apache2

3. Install required PHP extensions for Laravel 9

sudo apt install php8.1-common php8.1-bcmath php8.1-curl php8.1-dom php8.1-mbstring php8.1-intl php8.1-zip

4. Test Apache installation

Create a new file index.php in /var/www/html

rename index.html -> index.html_old

Edit the index.php with the following.

Read more

Share