Install Apache2 PHP and Mysql on a Raspberry Pi

How to install a webserver on Raspberry Pi 2 running Raspbian (wheezy)

Full list of edits and installs to get my webserver up and running without mySQL.

Make sure everything is up to date, this takes about 60 seconds:

Code: Select all

sudo apt-get update

Code: Select all

sudo apt-get upgrade

Now I’m going to need apache webserver

Code: Select all

sudo apt-get install apache2 apache2-doc apache2-utils

Code: Select all

sudo apt-get install libapache2-mod-php5 php5 php-pear php5-xcache php5-mysql php5-curl php5-gd

And that’s apache webserver and PHP installed.
Test it with:

Code: Select all

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);

?>

Now I’ll need to install php_curl

Code: Select all

sudo apt-get install php-curl

then reboot apache:

Code: Select all

sudo service apache2 restart

Now make sure mod_rewrite is enabled:

Code: Select all

sudo a2enmod rewrite

Finally: Getting the .htaccess files working.

Code: Select all

sudo nano /etc/apache2/sites-available/default

Change None to all:

Code: Select all

 <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
 </Directory>

I don’t think I’ve missed any steps, but I will come back and edit later if need be.

Install MySQL

Start with:

Code: Select all

sudo bash

Code: Select all

sudo apt-get install php-mysql

– AND:

Code: Select all

sudo apt-get install mysql-server mysql-client

Install PHPMyAdmin

Code: Select all

sudo apt-get install phpmyadmin

Install Webmin:
http://www.webmin.com/deb.html