23 June 2014
This tutorial shows how to set up Apache, PHP and MariaDB (drop-in replacement for MySQL). You can use pacman instead of yaourt on installing the server, since yaourt doesn't come with Arch in default. Although I suggest yaourt, it includes packages from user repository. I have found every single piece of software that I need from there(xmind, drush, netbeans), also it will keep them up to date.

Apache


Open up your terminal and install Apache by these commands.
Source code viewer
  1. # Log in as root.
  2. su -
  3. # Run update and upgrade.
  4. yaourt -Syua
  5. # Install apache.
  6. yaourt -S apache
Programming Language: Bash
Uncomment and change ServerName. After you have restarted httpd then you can create an index.html and write something in it to test if it works on localhost.
Source code viewer
  1. vim /etc/httpd/conf/httpd.conf
  2. # Change "#ServerName www.example.com:80" to "ServerName localhost:80".
  3. systemctl restart httpd
Programming Language: Bash

PHP


Continue with PHP installation by using these commands.
Source code viewer
  1. # Install PHP.
  2. yaourt -S php
  3. # Install Apache SAPI for PHP.
  4. yaourt -S php-apache
  5.  
  6. vim /etc/httpd/conf/httpd.conf
  7. # Uncomment "LoadModule rewrite_module modules/mod_rewrite.so".
  8. # Place this in the end of LoadModules: "LoadModule php5_module modules/libphp5.so".
  9. # Place this in the end of Includes: "Include conf/extra/php5_module.conf".
  10. # Place this in the top of "Include conf/extra/php5_module.conf": "AddHandler php5-script php".
  11. # Comment out "LoadModule mpm_event_module modules/mod_mpm_event.so".
  12. # Add "LoadModule mpm_prefork_module modules/mod_mpm_prefork.so" after the commented line.
  13. systemctl restart httpd
Programming Language: Bash

MariaDB


Continue with MariaDB installation by using these commands.
Source code viewer
  1. # Install MySQL or an alternative.
  2. yaourt -S mysql
Programming Language: Bash
Source code viewer
  1. vim /etc/php/php.ini
  2. # Uncomment "extension=pdo_mysql.so" and "extension=mysqli.so".
  3. systemctl restart httpd
  4. systemctl restart mysqld
Programming Language: Bash