0% found this document useful (0 votes)
38 views7 pages

Ubuntu21.10 LAMP PHP8.1

Installation d'un serveur LAMP (PHP8.1) sur Ubuntu 21

Uploaded by

jam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views7 pages

Ubuntu21.10 LAMP PHP8.1

Installation d'un serveur LAMP (PHP8.1) sur Ubuntu 21

Uploaded by

jam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

GNU/Linux Ubuntu 21.10 Installing LAMP PHP 8.

1 – Quick-
Start Guide
You are Welcome! The Tutorial Shows You Step-by-Step How to Install LAMP PHP 8.1 in
Ubuntu 21.10 Impish GNU/Linux.
And to get the PHP 8.1 Ubuntu Impish Installation, you have to Manually Setup the Ubuntu
Apt PPA Repository.
Especially relevant: the Guide include instructions on How to Replace MySQL with
MariaDB in LAMP Setup.
PHP 8 is a major Update of the PHP Language!
Moreover, the PHP 8 New Features includes:
•Named Arguments
•Union Types
•attributes
•Constructor Property Promotion
•Match Expression
•Nullsafe Operator
•JIT
Again this PHP 8.1 PPA includes also All the most Useful Extensions for PHP usage.
Finally, LAMP is de facto Web Development Standard. Today, the products that make up the
LAMP stack are included by default in nearly all GNU/Linux distributions.

1. Launching Terminal

Open a Terminal window


Ctrl+Alt+t on Desktop
(Press “Enter” to Execute Commands).
Or access the Server Shell.
[nextpage title=”Installing”]

2. Enabling PPA Repo

Add PHP PPA for Ubuntu GNU/Linux


Here Add PHP Repo for Ubuntu

3. Installing LAMP

Now to Install LAMP PHP 8.1 on Ubuntu


For the Default Setup play:

sudo apt install apache2 php8.1 mysql-server mysql-client php8.1-mysql

2.Or to replace MySQL with MariaDB Open Source Server


Here Enabling Latest MariaDB Repo for Ubuntu
In this case the Command become:

sudo apt install apache2 php8.1 mariadb-server mariadb-client php8.1-mysql

3.This Setup includes also the most useful Extensions and Tools.
Then Test your new Php with:

php -v

1. 4. Searching PHP 8.1 Extensions

Again to Search PHP 8.1 Extensions.


So you can Search for the available PHP 8 Extensions running:

apt search php8.1


And possibily refine the Result using a grep Pipe

apt search php8.1 | grep [KEYWORD]


Like for instance:

apt search php8.1 | grep mysql

4.Some useful Modules to Support a WordPress Website can be installed with:

sudo apt install php8.1-imagick php8.1-curl php8.1-gd php8.1-mbstring php8.1-xml php8.1-


xmlrpc php8.1-soap php8.1-intl php8.1-zip

Last, to Install multiple Packages at once you may use the following Syntax:

sudo apt install php8.1-{curl,xml,imagick,mysql,fpm,bz2}

1. 5. Testing LAMP

Finally, to Test LAMP WebServer Installation


Access the Server document’s location:

cd /var/www/html

6.Create a PHP Info file:

sudo nano info.php


If Got “User is Not in Sudoers file” then see: How to Enable sudo
And Append:

<?php

phpinfo();

?>
Ctrl+x to Save & Exit from nano Editor ;)
Set the www-data as User and Group:

sudo chown www-data:www-data info.php


Then Open on Browser the URL:
http://localhost/info.php

You should Successfully see the PHP Info notice similar to here above :)
How to Create an Apache 2 Virtual Host on Ubuntu 21.10 Impish.

How to Create an Apache Virtual Host on


Ubuntu 20.04
August 31, 2021 | By the+gnu+linux+evangelist | Filed in: Tutorial.
Name Based VHost

1. 1. Accessing Shell

Login into Server Shell.


Or Open a Command Line Terminal Window
(Press “Enter” to Execute Commands)
Ctrl+Alt+T

1. 2. Adding Domain

Add Domain to the hosts Config File


Crating it with the nano Editor:

sudo nano /etc/hosts

And append:

127.0.0.1 [myDomainName.com]

Just Replace Your real Domain Name to “[myDomainName.com]” :)


Ctrl+Shift+v to Paste Content on nano
Ctrl+x to Save and Exit from nano Editor

1. 3. Making Directory

Create the VHost Target Directory


Running:

sudo mkdir /var/www/html/[mySite]

Again Replace [mySite] in the above!


And may be also a Testing index.html:
sudo su -c 'echo "My New WebSite is Working! :)" > /var/www/html/[mySite]/index.html'

The above is just a siple Testing Content.


Last, Set the Folder’s Ownership with:

sudo chown -R www-data:www-data /var/www/html/[mySite]

1. 4. Making VHost Config File

Now Create a VHost Config File


Again with nano:

sudo nano /etc/apache2/sites-available/[myDomainName].conf

Append at Least:

<VirtualHost *:80>

ServerName[myDomainName.com]

ServerAliaswww.[myDomainName.com]

DocumentRoot /var/www/html/[mySite]

</VirtualHost>

To get a little More Insight may look:

cat /etc/apache2/sites-available/000-default.conf

1. 5. Enabling Virtual-Host

Next to Enable the New Virtual-Host


Access the Target Folder:

cd /etc/apache2/sites-enabled

And make a Symlink:


sudo ln -s ../sites-available/[myDomainName].conf .

1. 6. Restarting Apache

Restart Apache2 Web Server


Simply play:

sudo service apache2 restart

How to Enable Apache2 mod_rewrite Module on Ubuntu.


Here Enabling Apache2 Rewrite for Ubuntu

You might also like