Installing PHP, Apache, MySQL, and phpMyAdmin on Arch Linux

A step-by-step guide to installing PHP, Apache, MySQL, and phpMyAdmin on Arch Linux.

Why Arch Linux? Because I’m comfortable using Arch, and with its package manager, we can easily install the latest and most up-to-date kernel and software.

Video (in Indonesian):

  1. First, we ensure that our system is up to date by running:
1pacman -Syu
  1. Next, we install the necessary packages using:
1pacman -S php apache php-mcrypt phpmyadmin mysql
  1. We then navigate to the /etc/webapps/phpmyadmin directory and copy the phpmyadmin configuration file to /etc/httpd/conf/extra:
1cp /etc/webapps/phpmyadmin/apache.example.conf /etc/httpd/conf/extra/httpd-phpmyadmin.conf
  1. We include the configuration in the main httpd.conf file located in the /etc/httpd/conf directory by adding:
1# phpmyadmin configuration
2Include conf/extra/httpd-phpmyadmin.conf

Apache Config PHPMyAdmin

Then, we can access localhost and phpmyadmin in the browser.

  1. If there is a forbidden message in phpmyadmin, we need to add the DirectoryIndex index.html index.php configuration to /etc/httpd/conf/extra/httpd-phpmyadmin.conf, then restart the http server.

DirectoryIndex Apache

  1. If PhpMyAdmin can be accessed, but there is still an error message “The mysqli extension is missing.” or “The mcrypt extension is missing”; We need to enable the extension in php.ini by removing the semicolon (;) from the required extension.

PHP Extension

1extension=mcrypt.so
2extension=mysqli.so
3extension=mysql.so

Then, we can restart the http server again.

FYI: On Arch Linux, by default httpd runs as user http and group http. To make it more comfortable and avoid error messages on certain CMS installations, we need to change the permissions and owner of the /srv/http folder (where the public_html folder is located) using:

1chown -R http:http /srv/http

The installation process for Apache, PHP, MySQL, and PhpMyAdmin is now complete.

For now, this concludes the basics.