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

Redirect all request to public/ folder in laravel 5

There are two solutions:

1. Using .htaccess with mod_rewrite

RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]

2. You can add a index.php file containing the following code and put it under your root Laravel folder (public_html folder).

<?php
header('Location: public/');

Src: https://stackoverflow.com/questions/38040502/how-do-you-redirect-all-request-to-public-folder-in-laravel-5

Share

Install Laravel 5 Framework on Ubuntu 18.04 & 16.04

Below is the system requirements for the installation of latest Laravel application on your system.

PHP >= 7.2
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension
Ctype PHP Extension
JSON PHP Extension
BCMath PHP Extension

Step 1 – Install LAMP

To start with Laravel, we first need to set up a running LAMP server. If you have already running LAMP stack skip this step else use followings commands to set up the lamp on Ubuntu system.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.2 php7.2-mcrypt php7.2-gd php7.2-mbstring php7.2-xml

Install PHP Mcrypt Extension & Install Apache2

sudo apt-get install apache2 libapache2-mod-php7.2

Install MySQL

sudo apt-get install mysql-server php7.2-mysql

Step 2 – Install Composer

The composer is required for installing Laravel dependencies. So use below commands to download and use as a command in our

Read more

Share