A day or two ago I downloaded the latest release of raspbian stretch. I am currently busy installing all the components I require for a web server and mysql server. In the latest release, PHP5 has been removed and PHP7.0 has been installed. as far as I know, mysql has also been replaced with MariaDB (I have no idea what this is)

is there a way that I can install PHP5 and the original version of MySQL on the new stretch image?

I have tried adding the following to the /etc/apt/sources.list file and running an apt-get update as suggested at https://www.raspberrypi.org/forums/viewtopic.php?t=195818:

deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi

Unfortunately, PHP5 still cannot be installed because it cannot find the packages.

I could successfully install PHP7.0 and I then installed MariaDB (apparently) using the normal mysql-server installation method. MariaDB/Mysql worked fine. I could log in with root etc. That was until I installed PHPMyAdmin. After doing this, I could no longer log in with 'root'@'localhost' to the server.

Alas I reinstalled the SD card as all the fixes suggested on the webs resulted in syntax errors and I was not making any traction. Well here we are.

Even a guide on how to get all this shiny new stuff (PHP7.0, MariaDB & PHPMyAdmin) installed and working together would be appreciated. I just hope my application works with the new MariaDB/MySQL thingy as it uses many mysql statements and connections from python. The syntax errors I received while attempting to fix the root access issue is a bit worrying to me and makes me wonder if my python code will work with this new MariaDB MySQL or whatever.

Any help is appreciated.

  • 1
    Maria DB is a drop in replacement for MySQL. Why do you need older versions of these programs is there a specific backwards incompatability? Dec 8, 2017 at 4:19
  • I have not tested this as of yet. But I would love to test this on my own time to make sure it is done thoroughly instead of on a unit that I am building for a specific purpose where unforeseen issues may pop up later. The application I am worried about runs in python which reads and writes to mysql. Just basic selects and inserts. I also have a yii framework application which updates the same db. Im not sure if yii will have issues with php7.0 and mariadb. Dec 8, 2017 at 4:26
  • 1
    I strongly suggest you move your application to PHP7 since PHP5 is nearing the end of support ... Security updates end Dec 31, 2018.... IIRC mariaDB forked from mysql shortly after Oracle took over development of mysql. Many distros now have mariaDB as the default replacement of Oracle's mysql. Dec 8, 2017 at 4:52
  • I will give it a go. I guess there's no better time than the present. I found a guide to install maria using apt-get install maria-db. this is quite confusing as last night I used apt-get install mysql-server and it also installed maria-db but with a bunch of steps such as revoking access and dropping test DB's etc. Im not sure if this is where my root password flaked out on me. Anyway, I will try the mariadb route and see if that changes anything. Dec 8, 2017 at 5:33

1 Answer 1


You can downgrade your raspberry from Stretch to Jessie.

sudo nano /etc/apt/preferences 

and add following lines:

Package: * 
Pin: release a=oldstable 
Pin-Priority: 1001

And update upgrade

apt-get update
apt-get upgrade
apt-get dist-upgrade


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.