Setting Up Apache with PHP: Difference between revisions

From Alpine Linux
No edit summary
Line 2: Line 2:
Add the main packages with the command:
Add the main packages with the command:


{{Cmd|#apk add apache2 php-apache2}}
{{Cmd|#apk add apache2 php5-apache2}}


== Testing ==
== Testing ==

Revision as of 06:21, 5 June 2016

Installing Apache + PHP

Add the main packages with the command:

#apk add apache2 php5-apache2

Testing

Move to the directory where your site will reside:

#cd /var/www/localhost/htdocs

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

#vi index.php

Add the following lines in the file:

<?php phpinfo(); ?>

That done, let us start apache2 web server:

rc-service apache2 start

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

Ending

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.

Note

This is the easiest way to setup apache with php support, but it's the most inefficient (resource wise) setup, please refer to Apache with php-fpm