MAM Learning

Install apache, php, phpmyadmin di Archlinux

Update paket : sudo pacman -Syu

Install Apache sudo pacman -S apache

Jalankan dan aktifkan Apache sudo systemctl enable --now httpd, kini sudah bisa akses http://localhost.

Install PHP sudo pacman -S php php-apache

Konfigurasi Apache agar bisa memproses file PHP sudo nano /etc/httpd/conf/httpd.conf
Cari dan hapus atau comment (#) baris berikut (kalau ada): LoadModule mpm_event_module modules/mod_mpm_event.so.
Tambahkan baris berikut tepat di bawahnya:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule php_module modules/libphp.so
AddHandler php-script .php
Include conf/extra/php_module.conf
Tidak perlu ditambahkan jika sudah ada

Lalu tambahkan index.php di daftar DirectoryIndex, ubah bagian ini atau tambahkan jika belum ada :

DirectoryIndex index.php index.html

Install MariaDB (MySQL server) sudo pacman -S mariadb

Inisialisasi database: sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Amankan instalasi: sudo mysql_secure_installation

Aktifkan dan jalankan: sudo systemctl enable --now mariadb

Install phpMyAdmin sudo pacman -S phpmyadmin

Buka konfigurasi Apache lagi: sudo nano /etc/httpd/conf/httpd.conf

Tambahkan baris berikut di paling bawah: Include conf/extra/phpmyadmin.conf

Lalu buat file konfigurasi phpMyAdmin: sudo nano /etc/httpd/conf/extra/phpmyadmin.conf

Isi dengan:

Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin" DirectoryIndex index.php AllowOverride All Options FollowSymlinks Require all granted Require local

Atur PHP agar mengenali phpMyAdmin, edit file: sudo nano /etc/php/php.ini

Cari dan aktifkan ekstensi berikut (hapus tanda ; di depan):

extension=mysqli
extension=pdo_mysql
extension=mbstring
extension=iconv

Restart Apache sudo systemctl restart httpd

Buka di browser: http://localhost/phpmyadmin. Login dengan:
Username: root
Password: yang kamu buat di mysql_secure_installation