Install LAMP Stack (Apache, MariaDB, PHP, phpMyAdmin) on Arch Linux based systems

4) Install PHP

Use the below command to install PHP. PHP initially called Personal Home Page, now it is called as Hypertext Preprocessor. PHP is a open-source software which is designed for web development purpose. It is used for server-side scripting language as well as general-purpose programming language.

[Install php Module]
$ sudo pacman -Sy php php-apache php-gd php-mcrypt

4a) changes on php.ini Configuration

Edit the /etc/php/php.ini configuration file and uncomment or modify below listed lines which is necessary to run LAMP without issue.

$ sudo nano /etc/php/php.ini

[Set your timezone]
date.timezone = Asia/Kolkata

[Display errors to debug your PHP code]
display_errors = On

[For php-gd extensions]

[Configure MySQL/MariaDB extensions]

[bzip2 extensions]

[mcrypt php extensions]

4b) Add PHP Modules

Edit the /etc/httpd/conf/httpd.conf configuration file and add the PHP module so that web server can recognize the PHP pages.

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

[Add the below lines]
LoadModule php7_module modules/
AddHandler php7-script php
Include conf/extra/php7_module.conf

[Comment the below line]
#LoadModule mpm_event_module modules/

[Uncomment the below line]
LoadModule mpm_prefork_module modules/

Create test php file to check whether php is working with apache or not.

[Creating php info file]
$ sudo nano /srv/http/phpinfo.php
<?php phpinfo(); ?>

[Restart apache service]
$ sudo systemctl restart httpd.service

Open your web browser and navigate to http://localhost/phpinfo.php or http://your-server-ip-address/phpinfo.php or

5) Install phpMyAdmin

phpMyAdmin is a free open-source web-based administration tool for managing the MySQL, MariaDB servers which will help us to manage the database easily.

[Install phpMyAdmin]
$ sudo pacman -S phpmyadmin

Create the file /etc/httpd/conf/extra/phpmyadmin.conf and add the below values.

Configure phpMyAdmin
$ sudo nano /etc/httpd/conf/extra/phpmyadmin.conf
Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">
    DirectoryIndex index.php
    AllowOverride All
    Options FollowSymlinks
    Require all granted

Edit the /etc/httpd/conf/httpd.conf configuration file and include below line on end of the file.

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

Include conf/extra/phpmyadmin.conf

Restart apache service

$ sudo systemctl restart httpd.service

Open your web browser and navigate to http://localhost/phpmyadmin or http://your-server-ip-address/phpmyadmin or

[ac-box color=”lred” icon=”fa-exclamation-triangle”]
Just scroll down to bottom of the page, you may see the same error message which is showing on the above screen shot The configuration file now needs a secret passphrase (blowfish_secret). Why ? we are getting the error message, Due to empty password for blowfish_secret. So, just add the password to ride out the issue.

Navigate to /etc/webapps/phpmyadmin/ file and search the term (blowfish_secret) then add the password.

$ sudo nano /etc/webapps/phpmyadmin/

$cfg['blowfish_secret'] = '12345'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH!$

We are preparing all articles in-depth to understand by all level/stage Linux administrators. If the article is useful for you, then please spend less than a minute to share your valuable comments in our commenting section. Please stay tune with us…Good Luck.

One Comment on “Install LAMP Stack (Apache, MariaDB, PHP, phpMyAdmin) on Arch Linux based systems”

  1. Excelent!

    A step by step tutorial without dificulties, and easy to understand. Thanks for your effort.

    NOTE: Sorry for my bad English, my native language is Spanish.

Leave a Reply

Your email address will not be published. Required fields are marked *