Download LAMP (Apache, PHP 7.0 and MySQL/MariaDB and phpMyAdmin) Server IMG File that I have prepared for Raspberry pi and it will fit on 4GB SD card, this image comes with the LAMP stack and including Apache, PHP 7.0 and MySQL/MariaDB and phpMyAdmin pre installed and configured, you can download this image and burn it on SD card (minimum 4GB sd card required).This LAMP stack comes with Raspbian 10 (buster).
if you need help with how to copy img file to sd card please check this OS Installation and WiFi Configuration.
You need to expand the file system to the full size of the sd card. I did an update and upgrade to keep it all current to date 21-07-2018. The Image is 700 MB in size.
Note: If you want to use this image file for PiHome then you need to make small modification to Apache config file i.e change document root folder.
By default Apache server installed with document root pointing to /var/www/html, I have changed it to /var/www/ in /etc/apache2/sites-available/000-default.conf for PiHome to work.
52 comments
thank you very much for your hardwork, did you do any modification etc? do you have plan to do same for PiHome heating controller ?
@Garey thank you for comments, i m focusing on upgrading code to work with php7 but its hard to find free time these days… but to answer your question i haven’t done any work to make pihome as sd card image yet but may be in coming days..
I’m trying to download the image file but it keeps hanging and then failing. Is there another way to get the image perhaps like a torrent file?
@Sam, github have file size limit and i dont know if there is any torrent server where i can host this file. if you know and have some knowledge please let me know. you can used Firefox or google chrome to download this file and if it stoppes you can resume download from same location.
Admin
Dropbox?
Torrent?
do you have any torrent server?
i have updated for raspberry pi LAMP (Apache, PHP 7.0 and MySQL/MariaDB and phpMyAdmin) Server IMG File link to dropbox.
Admin
Hi, you say it will fit on 8GB SD card.
But when you unzip the file it comes to 14.8 GB.
Where can I get a .img file that will fit on 8Gig SD card?
Hi Hennard du Plessis,
i have update the img file, try to download it now its well below 8gb.
Admin
How do you set up a static IP?
it says in etc/network/interfaces that we must use etc/dhcpcd.conf but I put there the code that I was using with Strech instead of Jessy and I don’t get static IP. Here is the lines I used:
/etc/dhcpcd.conf.
interface eth0
static ip_address=192.168.0.200/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
Good work. Thank you.
H,
Thank you very much for your hard work, I tried this image with Pi3 B+ but it can’t boot, can you help?
Thank you in advance.
Hi,
I fix it and it works with Pi 3B+.
Boot the image with older Pi and then update the firmware “sudo rpi-update”. pull the SD card and boot it with Pi3 B+.
Tested work for me.
Thanks for your work!
Can u mention where the MOTD (Message of the Day) / Login Message is configured?
I love it, but wanna add some information.
Thanks in advance!
Max
Hey Max, if you are referring to the SSH MOTD:
1. edit the sshd_config file located in the SSH main dir (# nano /etc/ssh/sshd_config)
2. uncomment (-#) and amend line 93 so it reads: ‘PrintMotd yes’
3. uncomment (-#) and amend line 110 so it reads: ‘Banner /root/maxsfullysikbannerbro.txt’
4. save and close sshd_config (Ctrl X, Y, Enter)
5. put your root hat on (# sudo su)
6. navigate to root home dir (# cd ~)
7. create fully sick banner text file (#nano maxsfullysikbannerbro.txt)
8. insert fully sick banner content using plenty of ASCII text art from http://patorjk.com
9. save, close and give the text file read permissions (# chmod 775 maxsfullsikbannerbro.txt)
10. restart SSH service (# service ssh restart)
Yeah, this straight up just doesn’t even boot on my Pi3B+. Might want to mention that its not compatible with Pi3B+ as its a tad frustrating waiting 2 hours for something that doesn’t even post… FML.
Hi Zer0ne,
sorry i dont have Raspberry pi 3B+ so can not test it, some one said you can put your sd card in older model and update and upgrade and then then boot your rpi 3b+
Admin
Thanks man!
how cai move that i cant do it
default Apache server installed with document root pointing to /var/www/html, you need to change this in /etc/apache2/sites-available/000-default.conf for PiHome to work. DocumentRoot /var/www/htm
@Brain millan,
you can modify /etc/apache2/sites-available/000-default.conf as per instructions and set DocumentRoot /var/www and reboot pi or restart apache service
Perfect! Just what I needed!
hello,
i was downloaded image and burn sdcard,
but when i run the raspbery 3b+ i get color screen and still there..
the passwords don´t work. For OS is user “pi” pass “raspberry”, but, for PHPmyadmin? I tried all but don´t work. Thanks in advance.
are you referring to root/pihome2019 credentials ?
i refeer when i log in to http://myip/phpmyadmin. I log in with user phpmyadmin, but i have no privilegies to create anything. I tried all that you said in in “throubleshoting” and all i saw in internet, but nothing.
phpMyAdmin Login Credentials: as its on download page.
Username: phpmyadmin
Password: pihome2019
ok thanks, but in download popup say that password is “passw0rd”. i reinstalled all and works fine. thanks!
Hi,
originally downloaded the complete PiHome image and installed that on an SD card, this worked fine but I am using a RPi 4B with gpio connected sensors and relays. This image provided gpio 2.50 but this does not work with a RPi 4B, the gpio works correctly with python. I then tried to create the whole install manually using the standard Raspbian download and then install Apache, MariaDB and PHP, this seemed to go ok working from your website instructions and working through out the aspects were it is a little out of date with the current downloads e.g. php7.3 not php5. I see that there is now a link for LAMP with PHP7.0 and MariaDB but I did not find this at the time I started. I have reached the point where everything is installed as best as I know but when I go to the website on another network PC and put the IP address for the RPi I get a listing of the PiHome code displayed rather than the website executed. Do you know why this might be, if you can let me have an email address I can send the install log I created and an image of what I see on the website.
Regards
Harvey
@ Harvey,
did you follow all the steps as per this post?
http://www.pihome.eu/2017/11/02/install-apache-php-7-0-mysqlmariadb-raspberry-pi-lamp/
Hi James,
No I followed the post below:
http://www.pihome.eu/2017/10/11/apache-php-mysql-raspberry-pi-lamp/
Is it is best that I start from scratch with the above later process?
Regards Harvey
Hi James,
I have restarted the install using your new link, I am progressing (note PHP is version 7.3 not 7.0), the apache default server responds ok, but have hit a problem:
I have added to /etc/apt/sources.list:
deb http://repozytorium.mati75.eu/raspbian buster-backports main contrib non-free
#deb-src http://repozytorium.mati75.eu/raspbian buster-backports main contrib non-free
deb http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpi
When I try to run the certificate comand below the below:
sudo gpg –keyserver pgpkeys.mit.edu –recv-key CCD91D6111A06851
It fails saying no key server or something about NO_PUBKEY CCD91D6111A06851.
Do you know why?
@Harvey,
you dont need to modify anything, if you download Raspbian Buster light version and install all dependencies without modifying. that LAMP install instructions was for older version of Raspbian.
Thank you for the reply, I have continues and completed the installation.
When I go to the webpage I get this:
“Database Connecction Failed with Error: Access denied for user ‘pihomedbadmin’@’localhost’ (using password: YES)”
When I try to create a new user on the pi with command:
“CREATE USER ‘pihomedbadmin’@’0.0.0.0’ IDENTIFIED BY PASSWORD ‘YES’;”
It says the password must be a 41-digit hexadecimal number.
I have a couple of questions:
1) is local host 0.0.0.0 ok or should it be something else?
2) If is set a 41 digit password where do I change the password in the pihome code to match?
Thanks in advance for your continued help
Regards Harvey
i m no expert in mysql but i think you have to create user and set password with following two commands
CREATE USER ‘pihomedbadmin’@’localhost’ IDENTIFIED BY ‘pihome2018’;
CREATE USER ‘pihomedbadmin’@’%’ IDENTIFIED BY ‘pihome2018’;
you also need to set root password to pass0rd (its not o but its zero)
Files that are using mysql credentials AFAIK:
https://github.com/pihome-shc/pihome/blob/master/st_inc/_config.inc.php
https://github.com/pihome-shc/pihome/blob/master/cron/wifigw.py
sorry forget these lines, this gives users pihomedbadmin permission to access pihome database.
GRANT ALL ON *.* TO ‘pihomedbadmin’@’localhost’;
GRANT ALL ON *.* TO ‘pihomedbadmin’@’%’;
flush privileges;
Thanks James, I’m going to be out of this development loop for a little while due personal reasons. Probably be a couple of weeks before I can try this solution. Looking forward to connecting this to my heating system soon.
any specific reason you want to build all yourself, why not download img file and you are all set. author or this project have done huge fav. by building img file for raspberry pi.
@James,
i think Harvey, is using RPI4 and WiringPi version i have in img file may not be compatible with RPI4, i can not test this as i dont have raspberry pi 4.
Your correct a pi 4 rev B needs WiringPi with PIO 2.52, the download image has GPIO 2.50 and this does not work.
Regards Harvey
Hi James,
Started to be able to work on this project again, I have completed the CREATE USER, GRANT and flush privileges commands as stated and this seemed ok, all commands returned Query OK.
After this I rebooted the pi and tried to remote webpage, the message has changed and now returns “Database Connecction Failed with Error: Unknown database ‘pihome’ “. This makes me think that mysql is installed and the pihome2018 user setup correctly but the pihome database table has not been setup.
How do I setup / install / copy the pihome database into mysql?
PS admin are correct, I have a pi 4 rev B and want to use the local GPIO for temp sensors and relay control, to do this you need GPIO ver 2.52, the download has gpio 2.50 and this does not work with a pi 4 rev B. A shame in some ways but atleast doing it the hard way I learn about the overall set up.
Regards Harvey
Harvey,
there is setup file in
/MySQL_Database/setup_db.php
to install database but make sure username and password inside this file have proper access to MySQL/MariaDB server.Username and password change as per your installation.
$hostname = ‘localhost’;
$dbname = ‘pihome’;
$dbusername = ‘pihomedbadmin’;
$dbpassword = ‘pihome2018’;
Hi James,
Thank you for the db setup information, this has worked and on the web page I can now see the application and can navigate round the pages. My next set is to get the gpio 1 wire ds18b20 sensors working.
Running the file gpio_ds18b20.py I get an error.
The error I get when running the gpio_ds18b20.py file is:
Traceback (most recent call last);
File “gpio_ds18b20.py”, line 2, in
import time, os, fnmatch, MySQLdb as mdb, logging
ImportError: No module named MySQLdb
This looks like another database related error, is it anything to do with running MariaDB or is it something else.
Also thinking beyond this I ran cron -e to check the cron jobs loaded, the file displayed looks like a default file with some introductory instructions text. Do I need to replace this text with the contents of cronjobs.txt? Or do I do something else
Thanks for your continued help, feels like we are getting very close to a working setup.
Regards Harvey
Hi James,
To try and explore my built installation I put in my SD card I created from the readY to use image and it reminded me that when you login as root user you get the PiHome banner and ip address info auto displayed. My build installation does not do this so there my be another bit of setup for login auto start I am missing.
Hi James,
I have made some good progress, the login banner is now working because I have added login.py to the profile script run at login.
The temperature sensors now work, the issue was python-mysqldb was not installed.
I have deleted the old zones and added to new ones using my sensors and un-commented gpio_ds18b20.py in the crontab -e file. Running the file manually it reports correctly.
The problems I now have are:
1) Boiler.php errors when manually run, it is reporting a number of i2c related errors but as far as I know I have no i2c related references in the zones or boiler setup, what can I check/update to remove these errors?
2) The temperature sensors and graphs do not update even though I have added the sensors to crontab -e file and manually gpio_ds18b20.py executes with out error and updates the web page, what do you think is wrong?
Regards Harvey
Hi Harvey,
great work, you can comment out i2c lines from boiler.php or you can download new one from github as i have done this already for you. graph only gets drawn once you create zone and under setting you have to select which zone will get graph drawn.
Hi,
I have commented out the i2c lines and the errors have gone. Running boiler.php each zone contains a warning:
PHP Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in /var/www/cron/boiler.pho on line 122
How do I fix this?
Also I created schedules for my new zones but boiler.php says on each zone: stop cause no schedule.
Also I selected graphing for each zone but it’s not graphing them and the display of temperatures does not update.
Still a few issues but this helping me understand how it all works.
Regards Harvey
Hi Harvey, i see you been trying this for sometime at this stage, i can help you with remote session via teamviewer if you want. drop me email time and your timezone.
Hi,
My email address is [email protected] and I’m in the UK in time zone GMT.
With teamviewer will I be able to what is being done so I can understand the detail?
Regards Harvey
Hi, just wanted to let the developers know that I had to make a mod to the weather_update.php file to get the function to work, I suspect this is due to changes in the API call at openweather.org.
In three places in the ‘sixdays’ code I had remove the ‘/daily’ to change, the ‘5 day/3hr’ section had already been updated.
//$weather_sixdays_api = “http://api.openweathermap.org/data/2.5/forecast/daily?q=”.$city.”,”.$country.”&appid=”.$appid;
to
//$weather_sixdays_api = “http://api.openweathermap.org/data/2.5/forecast?q=”.$city.”,”.$country.”&appid=”.$appid;
@Harvey Gillingham,
Thank you for your feedback, i test both lines but it works ok on both lines for me may be this is changed for new api, i will change this on Github.
Hi Harvey,
Thank you for your updated, i have updated weather updated on github: Weather Update API changed