Completing Install of phpMyAdmin on CentOS 7
I'm using the tutorial at https://www.linode.com/docs/databases/mysql/managing-mysql-with-phpmyadmin-on-centos-6-4/
Install is successful, but under the heading "Force SSL", when I try to edit the /etc/phpmyadmin/config.inc.php file as directed, it says there is no such file or directory. A peek in filezilla confirms this. Is there an alternate location for this file?
Also under the next heading "Testing Your phpMyAdmin", when I go to https://www.synergyft.com/phpmyadmin/ as dirrected, it says "Forbidden
You don't have permission to access /phpmyadmin/ on this server."
Any ideas?
10 Replies
The guide you mentioned is for CentOS 6.4. On CentOS 7, the configuration file for PHPMyAdmin is located here:
/etc/httpd/conf.d/phpMyAdmin.conf
Be sure to restart Apache after making any changes:
systemctl restart httpd.service
I'd recommend changing any lines such as "Require ip" or "Allow from ip" to your local computer's IP address, so you're the only one that has access to it. By default, it only allows connections from "127.0.0.1" which is why you're seeing the "forbidden" error message.
Thanks, found it! I did change the IP address in 4 places. However, when I add "$cfg['ForceSSL'] = 'true';" to the /etc/httpd/conf.d/phpMyAdmin.conf file, Apache will not reload. It says: "Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details."
systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2018-06-28 20:51:31 UTC; 26s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 1056 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 423 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
Process: 1055 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 1055 (code=exited, status=1/FAILURE)
Jun 28 20:51:31 synft systemd[1]: Starting The Apache HTTP Server…
Jun 28 20:51:31 synft httpd[1055]: AH00526: Syntax error on line 77 of /etc/httpd/conf.d/phpMyAdmin.conf:
Jun 28 20:51:31 synft httpd[1055]: Invalid command '$cfg['ForceSSL']', perhaps misspelled or defined by a module not included in the server configuration
Jun 28 20:51:31 synft systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jun 28 20:51:31 synft kill[1056]: kill: cannot find process ""
Jun 28 20:51:31 synft systemd[1]: httpd.service: control process exited, code=exited status=1
Jun 28 20:51:31 synft systemd[1]: Failed to start The Apache HTTP Server.
Jun 28 20:51:31 synft systemd[1]: Unit httpd.service entered failed state.
Jun 28 20:51:31 synft systemd[1]: httpd.service failed.
journalctl -xe
-- Subject: Unit user-0.slice has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit user-0.slice has begun starting up.
Jun 28 20:50:02 synft systemd[1]: Started Session 972 of user root.
-- Subject: Unit session-972.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit session-972.scope has finished starting up.
-- The start-up result is done.
Jun 28 20:50:02 synft systemd[1]: Starting Session 972 of user root.
-- Subject: Unit session-972.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit session-972.scope has begun starting up.
Jun 28 20:50:02 synft CROND[1028]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jun 28 20:50:02 synft systemd[1]: Removed slice User Slice of root.
-- Subject: Unit user-0.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit user-0.slice has finished shutting down.
Jun 28 20:50:02 synft systemd[1]: Stopping User Slice of root.
-- Subject: Unit user-0.slice has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit user-0.slice has begun shutting down.
Jun 28 20:50:24 synft sshd[1033]: Did not receive identification string from 196.52.43.108 port 6666
Jun 28 20:51:30 synft polkitd[503]: Registered Authentication Agent for unix-process:1035:45502435 (system bus name :1.2084 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, loca
Jun 28 20:51:30 synft systemd[1]: Stopping The Apache HTTP Server…
-- Subject: Unit httpd.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit httpd.service has begun shutting down.
Jun 28 20:51:31 synft systemd[1]: Starting The Apache HTTP Server…
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit httpd.service has begun starting up.
Jun 28 20:51:31 synft httpd[1055]: AH00526: Syntax error on line 77 of /etc/httpd/conf.d/phpMyAdmin.conf:
Jun 28 20:51:31 synft httpd[1055]: Invalid command '$cfg['ForceSSL']', perhaps misspelled or defined by a module not included in the server configuration
Jun 28 20:51:31 synft systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jun 28 20:51:31 synft kill[1056]: kill: cannot find process ""
Jun 28 20:51:31 synft systemd[1]: httpd.service: control process exited, code=exited status=1
Jun 28 20:51:31 synft systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit httpd.service has failed.
-- The result is failed.
Jun 28 20:51:31 synft systemd[1]: Unit httpd.service entered failed state.
Jun 28 20:51:31 synft systemd[1]: httpd.service failed.
Jun 28 20:51:31 synft polkitd[503]: Unregistered Authentication Agent for unix-process:1035:45502435 (system bus name :1.2084, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
lines 3444-3505/3505 (END)
Thanks for clarifying! I mentioned the changes you need for the Apache configuration file, but you'll need to make changes to the PHP configuration file to enforce SSL. The PHP configuration file location depends on your particular setup, but is most likely here in CentOS 7:
/usr/share/phpmyadmin/config.inc.php
If it's not there, then the other location to check is the one you already mentioned:
/etc/phpmyadmin/config.inc.php
Be sure to remove the line from the Apache configuration file, and then restart Apache once you've finalized your changes.
Yes the “/usr/share/phpmyadmin/config.inc.php” file is the one I edited, and then Apache would not restart. I simply copied the code from the tutorial and pasted it directly into that file.
You mentioned deleting a line from another file? Can you clarify exactly which files need editing? Thank you for your time and effort!
You mentioned that you added the following line
"$cfg['ForceSSL'] = 'true';"
to the Apache configuration file at
/etc/httpd/conf.d/phpMyAdmin.conf
Then had the error, is that correct? If that's the case, try removing "$cfg['ForceSSL'] = 'true';" from /etc/httpd/conf.d/phpMyAdmin.conf and instead adding it to the following file:
usr/share/phpmyadmin/config.inc.php
If you've already tried adding it to usr/share/phpmyadmin/config.inc.php then try using PHPMyAdmin without it. It may work with you as-is without needing to force SSL, though I'd recommend connecting to it over SSL when possible, by adding https:// to the front of the url.
I understood from your first reply that in CentOS 7 "/etc/httpd/conf.d/phpMyAdmin.conf" replaces "usr/share/phpmyadmin/config.inc.php". When I try to edit "usr/share/phpmyadmin/config.inc.php", it tells me " Error writing usr/share/phpmyadmin/config.inc.php: No such file or directory "
Actually I just discovered "usr/share/phpmyadmin/config.inc.php" DOES exist, I had an issue with permissions. Fixed that, added "$cfg['ForceSSL'] = 'true';" to this file, then edited the IP address in the 4 places in the "/etc/httpd/conf.d/phpMyAdmin.conf" file, then restarted Apache.
However… https://www.synergyft.com/phpmyadmin/ still shows "403 Forbidden: You don't have permission to access /phpmyadmin/ on this server.".
The tutorial had me create a link in my website root directory as follow: ln -s /usr/share/phpMyAdmin
In that folder is an index.php file. I assume this is where the redirect takes you for https://www.synergyft.com/phpmyadmin/
I changed ownership -R for this directory to Apache, and did chmod 775. So I'm confused why the page returns "403 Forbidden: You don't have permission to access /phpmyadmin/ on this server.".
The IP addresses mentioned as "Require IP" or "Allow from IP" in /etc/httpd/conf.d/phpMyAdmin.conf are the only IP addresses that can connect to PHPMyAdmin. Any other IP addresses will see a 403 error. Have you added in all the IP addresses you may be connecting from?
If so, double check the file and directory permissions. We have a guide on changing permissions with chmod that may help.