Manjaro Linux – Install Apache, PHP, MariaDB – MySQL (LAMP)

To install “LAMP” – Apache, PHP, MySQL on Arch and Manjaro Linux do some steps:

First update Your operating system to latest version:

sudo pacman -Syyu

Apache

After updating Your system lets install Apache web server:

sudo pacman -S apache

Edit file /etc/httpd/conf/httpd.conf, search and comment the following line:
# LoadModule unique_id_module modules/mod_unique_id.so

sudo nano /etc/httpd/conf/httpd.conf

Enable Apache service and restart Apache service using commands:

sudo systemctl enable httpd
sudo systemctl restart httpd

Verify Apache status by command:

sudo systemctl status httpd

PHP

Now install latest version of PHP:

sudo pacman -S php php-apache

After installation we neet to configure out PHP.
Edit file: /etc/httpd/conf/httpd.conf

sudo nano /etc/httpd/conf/httpd.conf

Find the folowing line and comment it:

#LoadModule mpm_event_module modules/mod_mpm_event.so

Also uncomment or add the line:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Then add the following lines at the bottom of configuration file:

LoadModule php7_module modules/libphp7.so
AddHandler php7-script php
Include conf/extra/php7_module.conf

PHP installed. Now create index.php file in Apache home directory to check that PHP is installed correctly:

sudo nano /srv/http/index.php
<?php
phpinfo();
?>

Restart the PHP service:

sudo systemctl restart httpd

Go to http://127.0.0.1/ and check that Apache server with latest PHP version installed on your Manjaro Linux:

MySQL MariaDB

Install MySQL Server:

sudo pacman -S mysql

Initialize the MariaDB data directory prior to starting the service:

sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Enable and srart MySQL service:

sudo systemctl enable mysqld 
sudo systemctl start mysqld

Check that MySQL service installed and work correctly:

sudo systemctl status mysqld

After installation MySQL You need to setup root user and password:

sudo mysql_secure_installation

2 thoughts on “Manjaro Linux – Install Apache, PHP, MariaDB – MySQL (LAMP)”

  1. I just now wanted to thank you once more for this amazing web site
    you have made here. It truly is full of ideas for those
    who are truly interested in this particular subject, particularly this very post.
    You’re really all so sweet along with thoughtful of others in addition to the fact that reading your
    website posts is a fantastic delight to me. And exactly what a generous
    treat! Jeff and I will have pleasure making use of your guidelines in what we need to do
    in a few days. Our collection of ideas is a distance long and tips will
    certainly be put to very good use.

Comments are closed.