How to Install LAMP Server on Arch Linux (Apache+PHP+MariaDB) [2021]
Published on: August 17, 2021
Links
0. Intro
Hi all, in this video i will show how to install LAMP Server on Arch Linux.
I hope you enjoy!
1. Install Apache
$ sudo pacman -S apache
Save an close the file.
$ sudo systemctl enable --now httpd
$ sudo systemctl status httpd
Edit /srv/http/index.html and put following lines:
<html>
<title>Welcome</title>
<body>
<h2>Welcome to Apache test page!</h2>
</body>
</html>
Point your browser to http://localhost
2. Install PHP
$ sudo pacman -S php php-gd php-imagick imagemagick
Comment out the following lines in file /etc/php/php.ini:
extension=gd
extension=pdo_mysql
extension=mysqli
$ sudo pacman -S php-apache
In /etc/httpd/conf/httpd.conf, comment the line:
#LoadModule mpm_event_module modules/mod_mpm_event.so
and uncomment the line:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
To enable PHP, add these lines to /etc/httpd/conf/httpd.conf: Place this at the end of the LoadModule list:
LoadModule php_module modules/libphp.so
AddHandler php-script .php
Place this at the end of the Include list:
Include conf/extra/php_module.conf
Create the file /srv/http/info.php with following content:
<?php phpinfo(); ?>
Save the file.
Restart apache:
$ sudo systemctl restart httpd
Point your browser to http://localhost/info.php
3. Install MariaDB
$ sudo pacman -S mariadb
$ sudo mariadb-install-db --user=mysql \
--basedir=/usr \
--datadir=/var/lib/mysql
$ sudo systemctl enable --now mariadb
$ sudo mysql_secure_installation
$ sudo systemctl restart --now mariadb
$ mysql -u root -p
$ show databases;
$ quit