Setting Up Apache with PHP

From Alpine Linux
Revision as of 16:16, 27 December 2013 by Alacerda (talk | contribs) (Installing Apache + PHP)
Jump to: navigation, search

Installing Apache + PHP

Add the main packages with the command:

#apk add apache2 php-apache2


Move to the directory where your site will resides:

#cd /var/www/localhost/htdocs

And create an index.php file to test if everything is ok:

#vi index.php <?php phpinfo(); ?>

That done, let us start apache2 web server:

rc-service apache2 start

Now access: http://<ipa_ddress> and if everything is ok you will see the php info page.


Finally let us set up apache2 to start on operating system startup:

rc-update add apache2

Now you can create your php site and host in this directory.