Getting Started with Linux systems: Installing phpMyAdmin on CentOS

Source: Internet
Author: User
Tags install php mcrypt

problem: I am running a mysql/mariadb service on CentOS, and I want to use phpMyAdmin to manage the database through the network interface. What is the best way to install phpMyAdmin on CentOS?

phpMyAdmin is a PHP-based, Web MYSQL/MARIADB database management tool. Although there are already some lightweight database management tools such as Adminer, phpMyAdmin is more widely used by webmasters to perform various mysql/mariadb management tasks. It supports almost all MySQL database/table related operations, such as browse, create, copy, delete, rename, change, and MySQL user/Rights Management and database import/export. Here's how to install phpMyAdmin on CentOS 6 or 7.

Premise

To install phpMyAdmin on CentOS, you first need to set up a Web server (such as Apache or Nginx), install the MYSQL/MARIADB database and PHP. Depending on your preferences and needs, you can choose an installation from lamp and lemp.

CentOS 6.5 installation configuration lamp http://www.linuxidc.com/Linux/2014-07/104373.htm

Ubuntu 13.04 installation lamp\vsftpd\webmin\phpmyadmin services and Settings http://www.linuxidc.com/Linux/2013-06/86250.htm

CentOS 5.9 under Compile and install lamp (Apache 2.2.44+mysql 5.6.10+php 5.4.12) http://www.linuxidc.com/Linux/2013-03/80333p3.htm

RedHat 5.4 Under the Web server architecture source code construction Lamp Environment and application Phpwind http://www.linuxidc.com/Linux/2012-10/72484p2.htm

Lamp source Environment Build Web server linux+apache+mysql+php http://www.linuxidc.com/Linux/2013-05/84882.htm

Lamp optimization and reinforcement http://www.linuxidc.com/Linux/2014-07/104092.htm based on Ubuntu

Another requirement is to allow the Epel library to be installed on your centos. If you haven't set it up, please poke here.

Install the phpMyAdmin on CentOS6 or 7

Once you have set up the Epel library, you can easily install phpMyAdmin with the following command.

On CentOS 7:

    1. $ sudo yum install phpMyAdmin

On CentOS 7:

    1. $ sudo yum install phpmyadmin php-mcrypt
Configuring phpMyAdmin on CentOS 7

By default, phpMyAdmin on CentOS 7 only allows access from the loopback address (127.0.0.1). In order to be able to connect remotely, you need to change its configuration.

Open the PhpMyAdmin configuration file (path:/etc/httpd/conf.d/phpmyadmin.conf) with a text editor and locate and comment out the line of code with the word "Require IP XXXX". There will be lines of code like this, with "Require all granted" instead. The re-altered configuration file is shown below.

    1. $ sudo vi /etc/httpd/conf. D/phpMyAdmin. conf
  1. . . . . .
  2. <Directory/usr/share/phpMyAdmin/>
  3. Adddefaultcharset UTF-8
  4. <ifmodule mod_authz_core. C>
  5. # Apache 2.4
  6. <requireany>
  7. #Require IP 127.0.0.1
  8. #Require IP:: 1
  9. Require all granted
  10. </requireany>
  11. </ifmodule>
  12. <ifmodule! Mod_authz_core. C>
  13. # Apache 2.2
  14. OrderDeny, allow
  15. Denyfrom all
  16. Allowfrom127.0. 0.1
  17. Allowfrom::1
  18. </ifmodule>
  19. </Directory>
  20. <Directory/usr/share/phpMyAdmin/setup/>
  21. <ifmodule mod_authz_core. C>
  22. # Apache 2.4
  23. <requireany>
  24. #Require IP 127.0.0.1
  25. #Require IP:: 1
  26. Require all granted
  27. </requireany>
  28. </ifmodule>
  29. <ifmodule! Mod_authz_core. C>
  30. # Apache 2.2
  31. OrderDeny, allow
  32. Denyfrom all
  33. Allowfrom127.0. 0.1
  34. Allowfrom::1
  35. </ifmodule>
  36. </Directory>
  37. . . . . .

Finally, restart the httpd for the changes to take effect.

    1. $ sudo systemctl restart httpd
Configuring phpMyAdmin on CentOS 6

By default, phpMyAdmin on CentOS 6 is prohibited from accessing from each IP address. In order to be able to connect remotely, you need to change its configuration.

Open the PhpMyAdmin configuration file (path:/etc/httpd/conf.d/phpmyadmin.conf) with a text editor and locate and comment out the line of code for the word "Deny from all". Then change the line of code "allow from 127.0.0.1" to "Allow from 0.0.0.0". The re-altered configuration file is shown below.

    1. $ sudo vi /etc/httpd/conf. D/phpmyadmin. conf
    1. <directory"/usr/share/phpmyadmin">
    2. Order Deny,allow
    3. # Deny from all
    4. Allow from 0.0.0.0
    5. </Directory>

The next step is to encrypt the phpMyAdmin configuration file with the Blowfish encryption tool. This step requires the password in the encrypted cookie to be part of the cookie-based authentication.

Open the file shown in the following path with a text editor and set a random password with Blowfish, as shown below.

    1. $ sudo vi /usr/share/phpmyadmin/config. Inc. PHP
    1. $cfg[' Blowfish_secret ']=' kd5g}d33axdc50! ' ; / * must FILL in the This for COOKIE auth! */

Finally, restart the httpd for the changes to take effect.

    1. $ sudo service httpd restart
Test phpMyAdmin

To test whether the phpMyAdmin is set successfully, visit this page: Http://<web-server-ip-addresss>/phpmyadmin

You should be able to record any MySQL user (such as root) and manage MYSQL/MARIADB database/table through the Web interface.

Troubleshooting

Here are some of the problem solving methods that are encountered during installation of phpMyAdmin on CentOS.

  1. When you try to connect the phpMyAdmin page in your browser, you see "403 Forbidding" error:

    You don't have permission to access/phpmyadmin on this server.

    This error occurs because the IP address remote connection is blocked by the phpMyAdmin by default. To fix this error, you need to edit its configuration file to allow remote connections. See above for specific operation.

  2. When you connect the phpMyAdmin page, you see "The configuration file now needs a secret passphrase (Blowfish_secret)." Information, and you cannot log in.

    To fix this error, you need to edit/usr/share/phpmyadmin/config.inc.php this file to add a random blowfish password, and then restart httpd as shown below.

      1. $cfg[' Blowfish_secret ']=' kd5g}d33axdc50! ' ; / * must FILL in the This for COOKIE auth! */
      1. $ sudo service httpd restart (CentOS6)
      2. $ sudo systemctl restart httpd (CentOS7)
  3. When you connect the phpMyAdmin page, you see "Cannot load mcrypt extension. Please check your PHP configuration "error message.

    To fix this error, install the following package:

    1. $ sudo yum install php-mcrypt

    Then restart HTTPD:

    1. $ sudo service httpd restart (CentOS6)
    2. $ sudo systemctl restart httpd (CentOS7)

Example of the cooperative application of lamp architecture--phpmyadmin http://www.linuxidc.com/Linux/2013-07/87645.htm

Lamp application of phpMyAdmin, Wordpress http://www.linuxidc.com/Linux/2013-04/82757.htm

phpMyAdmin Old Login time-out workaround http://www.linuxidc.com/Linux/2012-09/70715.htm

Ubuntu installation phpMyAdmin and Adminer http://www.linuxidc.com/Linux/2012-08/69419.htm

SSL functionality is implemented on lamp basis and phpMyAdmin http://www.linuxidc.com/Linux/2012-07/66905.htm is installed

Ubuntu 14.04 configuration Lamp+phpmyadmin PHP (5.5.9) Development environment Http://www.linuxidc.com/Linux/2014-10/107924.htm

phpMyAdmin Details : please click here
phpMyAdmin : please click here.

For more information on CentOS, see the CentOS feature page http://www.linuxidc.com/topicnews.aspx?tid=14

This article permanently updates the link address : http://www.linuxidc.com/Linux/2014-12/110847.htm

Getting Started with Linux systems: Installing phpMyAdmin on CentOS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.