Installing Apache, MySQL, PHP, and phpMyAdmin on Arch Linux
Home > Tutorial > Installing Apache, MySQL, PHP, and phpMyAdmin on Arch Linux
Archive
- Installing Apache, MySQL, PHP, and phpMyAdmin on Arch Linux 2021
- Configuring an Apache Virtual Host on Arch Linux Jun 12, 2021
- How to Deploy a Static Blog to GitHub Pages Nov 17, 2026
- How to Sign Up for make.fun with an Agent and Let the Agent Find Bounties on Its Own Nov 17, 2026
- How to Mint Free NFTs on BSC Safely Nov 30, 2026
- How to Make Automated Story YouTube Shorts (Stickman + TTS) Nov 30, 2026
بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
Apache is a very popular web server, developed by the Apache Software Foundation. This time I'll share my experience on how to set up Apache and how to optionally integrate it with PHP.
Installation
1. sudo pacman -S php apache mariadb php-apache phpmyadmin
2. yay -S php-mcrypt
Configuration
sudo nano /etc/httpd/conf/httpd.conf
Comment out the following line:
LoadModule mpm_event_module modules/mod_mpm_event.so
then uncomment the following line:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
then add the following and save:
LoadModule php_module modules/libphp.so
AddHandler php-script .php
Include conf/extra/php_module.conf
Start httpd, then check its status:
1. sudo systemctl enable httpd
2. sudo systemctl restart httpd
3. sudo systemctl status httpd
MySQL configuration:
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
then run:
1. sudo systemctl enable mysqld
2. sudo systemctl start mysqld
3. sudo systemctl status mysqld
Once it's running, set a root password for MySQL (if asked any questions, just press Enter. See the image below for an example):
mysql_secure_installation
Let's test PHP. First, create a test.php file in /srv/http/:
sudo nano /srv/http/test.php
Open http://localhost/test.php in your browser:
Next, configure phpMyAdmin:
sudo nano /etc/php/php.ini
then enable the following extensions by removing the semicolon ";" in front of them, or add the extension if it's not in the list:
extension=pdo_mysql
extension=mysqli
extension=bz2
extension=zip
extension=iconv.so
Configure the phpMyAdmin file:
sudo nano /etc/httpd/conf/extra/phpmyadmin.conf
add it to /etc/httpd/conf/httpd.conf, then restart httpd:
Include conf/extra/phpmyadmin.conf
Open http://localhost/phpmyadmin/ in your browser:
Hope this helps.
References
- https://wiki.archlinux.org/title/Apache_HTTP_Server
- https://wiki.archlinux.org/title/PHP
- https://wiki.archlinux.org/title/phpMyAdmin
Like this tutorial? Support the author so there are more free tutorials.
Support via Saweria
Comments