Troubleshooting Apache, PHP 7.0, and MariaDB LAMP, LAMP is an acronym that stands for Linux Apache, MySQL/MariaDB and PHP. I have LAMP installation post for PiHome but i see lots and lots of people are looking for setting up php 7 with phpMyAdmin and MariaDB on raspberry pi and there isn’t any comprehensive set of instruction that covers this all for PHP 7, MariaDB on raspberry pi.
If you are installing LAMP on your Raspberry Pi for PiHome follow OS (Raspbian Jessie) Installation and WiFi Configuration posts to install and get WiFi configured without any screen connected to Raspberry pi.
In this post i will discuss common issues with php 7, MariaDB and phpmyadmin on raspberry pi. Follow this link to Install Apache, PHP 7.0 and MySQL/MariaDB on a Raspberry Pi (LAMP) with phpMyAdmin on Raspberry Pi.
Missing PhpMyAdmin User and Database Tab
phpMyAdmin main screen no “User Tab” and Under “Database Tab” Create Database – “No Privileges ” . What can I do to Get the “User Tab” and Privileges, run following command and follow the on screen steps.
1 |
sudo mysql_secure_installation |
This will fix your issue, You may need to check phpmyadmin.config files as well for MySQL/MariaDB username and password. and make sure you have correct mysql/mariadb credentials.
/etc/dbconfig-common/phpmyadmin.conf
1 2 3 4 5 6 7 8 |
# dbc_dbpass: database user password # the password to use with the above username when connecting # to a database, if one is required dbc_dbpass='passw0rd' # dbc_dbadmin: name of the administrative user # this is the administrative user that is used to create all of the above dbc_dbadmin='root' |
gpg: no valid OpenPGP data found.
If you get Error message for gpg: no valid OpenPGP data found.
1 2 3 4 5 6 7 8 9 10 |
root@pihome:~# sudo gpg --keyserver pgpkeys.mit.edu --recv-key CCD91D6111A06851 gpg: directory `/root/.gnupg' created gpg: new configuration file `/root/.gnupg/gpg.conf' created gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run gpg: keyring `/root/.gnupg/secring.gpg' created gpg: keyring `/root/.gnupg/pubring.gpg' created gpg: requesting key 11A06851 from hkp server pgpkeys.mit.edu gpgkeys: key CCD91D6111A06851 can't be retrieved gpg: no valid OpenPGP data found. gpg: Total number processed: 0 |
Make sure you edit your /etc/apt/sources.list file and it should look like
1 2 |
deb http://repozytorium.mati75.eu/raspbian jessie-backports main contrib non-free #deb-src http://repozytorium.mati75.eu/raspbian jessie-backports main contrib non-free |
E: Package ‘mariadb-server’ has no installation candidate E: Unable to locate package mariadb-client
If you get this error message while installing MariaDB, You have to determine which version of raspbian you have installed.
1 |
cat /etc/os-release |
After figuring out which version choose the one for jessie or the one for stretch. Make sure you choose the correct repository for the version of raspbian. (Thanks to Jonathan)
If you are looking for Raspberry pi SD card image for LAMP (Apache, PHP 7.0 and MySQL/MariaDB on a Raspberry Pi with phpMyAdmin) pre installed then check out Download section.
Reinstall PhpMyAdmin
if you think you made to many mistakes and you need to reinstall phpmyadmin then issue this command.
1 |
sudo dpkg-reconfigure phpmyadmin |
if above doesn’t work then try
1 |
sudo apt-get --purge remove phpmyadmin |
Now install phpmyadmin
1 |
apt-get install phpmyadmin |
PhpMyAdmin – Unable to login as root
If you are unable to login to phpMyAdmin as root credentials then the simplest solution will be create a new user and grant required privileges to this user.
Login to MySQL/MaridaDB
1 |
sudo mysql --user=root mysql |
MySQL/MariaDB User for phpMyAdmin
No lets create user for phpmyadmin, Run the following three commands while still logged in to MySQL/MariaDB.
1 2 3 |
CREATE USER 'piphpmyadmin'@'localhost' IDENTIFIED BY 'pihome2018'; GRANT ALL PRIVILEGES ON *.* TO 'piphpmyadmin'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; |
Update phpMyAdmin Config
Edit /etc/dbconfig-common/phpmyadmin.conf file updating username and password values in the following sections.
1 2 3 4 5 6 7 8 |
# dbc_dbuser: database user # the name of the user who we will use to connect to the database. dbc_dbuser='piphpmyadmin' # dbc_dbpass: database user password # the password to use with the above username when connecting # to a database, if one is required dbc_dbpass='pihome2018' |
PhpMyAdmin Errors
if you get “Connection for controluser as defined in your configuration failed.“ then you need to check /etc/phpmyadmin/config-db.php and check all database information are correct i.e dbusername and dbpassword.
1 2 3 4 5 6 7 |
$dbuser='dbusername'; $dbpass='dbpassword'; $basepath=''; $dbname='phpmyadmin'; $dbserver='localhost'; $dbport='3306'; $dbtype='mysql'; |
if you get “ERROR 1396 (HY000): Operation CREATE USER failed for <username>” then you need to check /etc/dbconfig-common/phpmyadmin.conf and look for dbc_dbuser and dbc_dbpass and make sure these are correct and same as in /etc/phpmyadmin/config-db.php
1 2 3 4 5 6 7 8 |
# dbc_dbuser: database user # the name of the user who we will use to connect to the database. dbc_dbuser='dbusername' # dbc_dbpass: database user password # the password to use with the above username when connecting # to a database, if one is required dbc_dbpass='dbpassword' |
12 comments
Note: i m working on SD card image with Rasbian, PHP 7.0 and MySQL/MariaDB on a Raspberry Pi (LAMP) with phpMyAdmin but i m waiting for 8gb sd card delivery. let me know if you want to include anything in this image.
When you think you will have raspberry pi SD card image ready for lamp (php7 and maridadb)?
I have pihome installed on my p3 . I cloned the system from GIT and I seem to have no control . It is as if I am in demo mode. I have no sensors connected yet. I will be using 1 wire temp sensors. Have I missed something? I cannot edit not add zones.
Thanks
Hi Ed,
need more information to help you as what you mean when you save you dont have control.
can you try to run php /var/www/cron/boiler.php from console and see if you can get any output and share it here.
Thank you
Hi,
I can’t seem to make any changes to any of the modes. It seems to be running only the sample info Here is the results of the command:
| __ \ (_) | | | |
| |__) | _ | |__| | ___ _ __ ___ ___
| ___/ | | | __ | / _ \ | |_ \_ \ / _ \
| | | | | | | | | (_) | | | | | | | | __/
|_| |_| |_| |_| \___/ |_| |_| |_| \___|
S M A R T H E A T I N G C O N T R O L
*******************************************************
* Boiler Script Version 0.4 Build Date 31/01/2018 *
* Update on 14/02/218 *
* Have Fun – PiHome.eu *
*******************************************************
2018-03-17 00:20:11 – Boiler Script Started
——————————————————————————– ——–
2018-03-17 00:20:11 – Zone ID: 33
2018-03-17 00:20:11 – Zone: Ground Floor Controller: 101 Controller Child: 1 Zon e Status: 1
2018-03-17 00:20:11 – Zone: Ground Floor Start Cause: Frost Protection – Target C: Zone C:
——————————————————————————– ——–
2018-03-17 00:20:11 – Night Climate Enabled for This Zone
2018-03-17 00:20:11 – Zone ID: 34
2018-03-17 00:20:11 – Zone: First Floor Controller: 101 Controller Child: 2 Zone Status: 1
2018-03-17 00:20:11 – Zone: First Floor Start Cause: Frost Protection – Target C :18 Zone C:
——————————————————————————– ——–
2018-03-17 00:20:11 – Zone ID: 35
2018-03-17 00:20:11 – Zone: Ch. Hot Water Controller: 101 Controller Child: 3 Zo ne Status: 1
2018-03-17 00:20:11 – Zone: Ch. Hot Water Start Cause: Frost Protection – Target C: Zone C:
——————————————————————————– ——–
2018-03-17 00:20:11 – Boiler Node ID: 100 Child ID: 1
2018-03-17 00:20:11 – Boiler Fired Status: 1
2018-03-17 00:20:11 – Boiler Hysteresis Status: 0
——————————————————————————– ——–
2018-03-17 00:20:11 – Boiler Script Ended
******************************************************************************** ********
root@PiHeat:~#
Thanks
PS
I do not have and sensors connected to it yet.
The Time appears to be 4 hours ahead of my time zone. It was 20:20 when that I ran that command
Hi Ed,
you can modify timezone settings have look at this http://www.pihome.eu/2017/10/11/raspberry-pi-system-optimisation/
on modifying zone name etc. you can use phpmyadmin to modify all that info.
Admin
So I need to make entries in the MySql DB to add zones, devices, etc? I used raspi-config and my date/time is correct on the command line, but not in PiHome. It is if there is a python or perl script not running to update the gui
Hi Ed,
you can change timezone settings in php, Modify functions.php and change following to your location
date_default_timezone_set(“Europe/Dublin”); or you can download new version from github today and modify settings in database. for future please leave comments in relevant post.
Admin
http://repozytorium.mati75.eu/raspbian
this repository dosen’t available ….
Hi,
untill i find another repository, you can download sd card image file that include all you need to have web server up and running on raspberry pi.