VAAMP - part 2

In this three-part series, I'll walk you through setting up a cross-platform LAMP server for local development.  I'll be using VirtualBox, Alpine Linux, Apache, MySQL, and PHP so I've nicknamed it VAAMP.


Apache, MySQL, and PHP setup



If you don't want to manually perform all the steps below, you can just download the VirtualBox appliance here.


1.  Make sure to follow Part 1 of this guide and login as root

2.  Install Apache httpd, MySQL (MariaDB), and PHP-FPM by running this command:

apk add gd mysql curl apache2-proxy php-fpm php-common php-iconv php-json php-gd php-curl php-xml php-mysql php-mysqli php-pdo php-pdo_mysql php-imap php-soap php-xmlrpc php-posix php-mcrypt php-gettext php-ldap php-ctype php-dom php-pear

3.  Configure Apache with these commands:

sed -i 's,\(LoadModule mpm_prefork_module modules/\),#\1,g' /etc/apache2/httpd.conf

sed -i 's,#\(LoadModule mpm_event_module modules/\),\1,g' /etc/apache2/httpd.conf

4.  Set httpd-mpm to default values:

cp /etc/apache2/original/extra/httpd-mpm.conf /etc/apache2/conf.d/

5.  Assuming you kept the hostname as localhost in Part 1, Step 24, configure PHP via these commands:

sed -i 's,\(DirectoryIndex index.html index.html.var\),#\1,g' /etc/apache2/httpd.conf

echo 'ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://$1' >> /etc/apache2/httpd.conf

echo 'DirectoryIndex index.html index.php' >> /etc/apache2/httpd.conf

echo '<?php phpinfo(); ?>' > /var/www/localhost/htdocs/phpinfo.php

6.  Initialize MariaDB:

/etc/init.d/mariadb setup

curl -sLo /var/www/localhost/htdocs/adminer.php

7.  Add Apache, MariaDB and PHP to the OpenRC init process (so they start at boot) and then start them:

rc-update add apache2 default && rc-update add mariadb default && rc-update add php-fpm default

/etc/init.d/apache2 restart && /etc/init.d/mariadb restart && /etc/init.d/php-fpm restart

8.  To test Apache, assuming you used in Part 1, Step 24, open a browser on your host computer and go to

9.  To test PHP, go to

10. To test MariaDB, go to and click Login

Congratulations!  You've installed a LAMP server on VirtualBox.  Head on over to the next post in this series: VirtualHost, shared folder, and DNS setup




Post a Comment

Keep it clean and professional...