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]
extension=gd.so

[Configure MySQL/MariaDB extensions]
extension=pdo_mysql.so
extension=mysqli.so

[bzip2 extensions]
extension=bz2.so

[mcrypt php extensions]
extension=mcrypt.so

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/libphp7.so
AddHandler php7-script php
Include conf/extra/php7_module.conf

[Comment the below line]
#LoadModule mpm_event_module modules/mod_mpm_event.so

[Uncomment the below line]
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

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 http://127.0.0.1/phpinfo.php
install-lamp-on-manjaro-arch-linux-3

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
</Directory>

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 http://127.0.0.1/phpmyadmin
install-lamp-on-manjaro-arch-linux-4b

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/config.inc.php file and search the term (blowfish_secret) then add the password.

$ sudo nano /etc/webapps/phpmyadmin/config.inc.php

$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.

You may also like...