Difference between revisions of "Setting Up Apache with PHP"

From Alpine Linux
Jump to: navigation, search
(Installing Apache + PHP)
(Testing)
Line 12: Line 12:
 
And create an index.php file to test if everything is ok:
 
And create an index.php file to test if everything is ok:
  
{{Cmd|#vi index.php
+
{{Cmd|#vi index.php}}
  
<?php
+
Add the following lines in the file:
 +
 
 +
{Cmd|<?php
 
phpinfo();
 
phpinfo();
 
?>}}
 
?>}}
Line 22: Line 24:
 
{{Cmd|rc-service apache2 start}}
 
{{Cmd|rc-service apache2 start}}
  
Now access: http://<ipa_ddress> and if everything is ok you will see the php info page.
+
Now access: http://<ip_address> and if everything is ok you will see the php info page.
  
 
== Ending ==
 
== Ending ==

Revision as of 19:40, 2 January 2014

Installing Apache + PHP

Add the main packages with the command:

#apk add apache2 php-apache2

Testing

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

Add the following lines in the file:

{Cmd|<?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.