This is for a dev environment. Let’s start by installing apache
pacman -S apache
Now install PHP
pacman -S php php-apache php-mcrypt
Installing MySQL (MariaDB)
pacman -S mariadb
Now, edit /etc/php/php.ini and effect the following changes:
date.timezone = Europe/Berlin
display_errors=On
extension=iconv.so
extension=ldap.so
extension=soap.so
extension=mcrypt.so
extension=mysqli.so
extension=pdo_mysql.so
Now, let’s configure MySQL
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
Start mysqld
systemctl start mysqld.service
And then
mysql_secure_installation
Now change your /etc/httpd/conf/httpd.conf as follows:
User dth
Group users
DocumentRoot "/home/dth/www"
#LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
# Place after LoadModule dir_module modules/mod_dir.so :
LoadModule php7_module modules/libphp7.so
LoadModule rewrite_module modules/mod_rewrite.so
# Place this at the end of the include list
Include conf/extra/php7_module.conf
Since I don’t want httpd and mariadb to start on boot, I wrote a little script to quickly start/stop/restart them:
#!/bin/bash
start_services() {
sudo systemctl start httpd.service
sudo systemctl start mysqld.service
}
stop_services() {
sudo systemctl stop httpd.service
sudo systemctl stop mysqld.service
}
case "$1" in
start) start_services ;;
stop) stop_services ;;
restart) stop_services; start_services ;;
*) echo "usage: webdev start|stop|restart" >&2
exit 1
;;
esac