Install apache php7 mySQL and phpmyadmin on Raspbian Stretch on a RaspberryPi

I've been eagerly awaiting the fourth version of the RaspberryPi for a while, but when it passed the point where I had expected it to be released I googled it only to find that the next incarnation may be a while.

Darn it, I have to get anothe RaspberryPi3. So the time has come to commission it and I find the lastest version of Raspian called stretch is out and theres been a few other updates. PHP5 has finally been updated and now is now officially available in the 7th flavour having missed out 6 completely - only 7.0 though, no 7.1. MySQL is gone instead being replaced by MariaDB (think it is just a rebrand though. Still on Apache version 2 though so not everything has changed.

No biggie really except all those handy internet how-tos are all out of date so I thought I'd bring you the way I takled it.

First off, update everything, you'll need to be running this in bash or over SSH:

sudo apt-get update -y && sudo apt-get dist-upgrade -y && sudo apt-get autoclean && sudo apt-get autoremove

next up install LAMP:

sudo apt-get install apache2 php7.0 mariadb-server-10.1 

Then PHPmyAdmin:

sudo apt-get install phpmyadmin

Just follow the prompts and teir default setting, I've split this part out as I was getting error when I ran it all as one:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory").

Then type


to get the IP address of the raspberrypi

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
	        inet  netmask  broadcast

After we've completed these steps we can head over to a browser on a computer running of the network of you rapberrypi and type and type the following URL out chaning out the IP address you th one you are seeing:

this should send you over to a page looking something like this:

Bang in the details you entered during setup and Bob's your uncle.

Search Posts

Back to top