Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phpMyAdmin "Cannot load or save configuration"

I have been trying to setup phpMyAdmin on a macbook pro running yosemite 10.10.2. I have created a config folder in phpmyadmin and have given it the permissions required:

chmod o+wr ~/Sites/phpmyadmin/config

However, when I then go onto "localhost/phpmyadmin/setup" I get an error:

Cannot load or save configuration
Please create web server writable folder config in phpMyAdmin top level 
directory as described in documentation. Otherwise you will be only able to 
download or display it.

(I have tried attaching an image, but can't due to my reputation points)

I have tried resetting the permissions, tried deleting and recreating the folder. Tried redownloading the phpmyadmin zip but nothing seems to work.

Could anyone kindly advise me what I am doing wrong and how I am best placed to solve this issue?

like image 313
Mr Sury Avatar asked Oct 20 '22 19:10

Mr Sury


1 Answers

I have had similar issue on my Ubuntu 16.04. I made a research and in the end I found a resolution of the issue. Maybe my case solution will help somebody else.

Background: For security reasons I have non privileged user and group apache:apache (sudo groupadd apache | useradd -g apache apache). They are preset by directives (User apache; Group apache) in /etc/apache2/apache2.conf. This user apache:apache owns Apache2 main directory (sudo chown -R apache:apache /etc/apache2) and some other files, for example: sudo chown -R apache:apache/etc/phpmyadmin/htpasswd.setup

In this manual: http://docs.phpmyadmin.net/en/latest/setup.html - I found that...

Debian and Ubuntu have changed way how setup is enabled and disabled, in a way that single command has to be executed for either of these.

To allow editing configuration invoke:

/usr/sbin/pma-configure

To block editing configuration invoke:

/usr/sbin/pma-secure

Note! In the content of the two files listed above we talk about /var/lib/phpmyadmin/config.inc.php instead of /etc/phpmyadmin/config/config.inc.php. It was the key.

In my case I was modified the content of these scripts (see below) and now I can use localhost/phpmyadmin/setup properly.

/usr/sbin/pma-configure:

#!/bin/sh
echo "Unsecuring phpMyAdmin installation..."
echo "Setup script can now write to the configuration file."
echo 
echo "Do not forget to run /usr/sbin/pma-secure after configuring,"
echo "otherwise your installation might be at risk of attack."

sudo sudo chown -R apache:apache /var/lib/phpmyadmin/config.inc.php
chmod 0660 /var/lib/phpmyadmin/config.inc.php

/usr/sbin/pma-secure:

#!/bin/sh
echo "Securing phpMyAdmin installation..."
echo "Setup script won't be able to write configuration."

sudo sudo chown -R root:root /var/lib/phpmyadmin/config.inc.php
chmod 0640 /var/lib/phpmyadmin/config.inc.php
like image 94
pa4080 Avatar answered Oct 22 '22 16:10

pa4080