Nginx the tutorial on installing and configuring phpMyAdmin on the server _php tips

Source: Internet
Author: User
Tags curl fpm phpmyadmin

First, the preparatory work:

1. If MySQL root account is empty, you need to set the root password
CentOS under the default installed MySQL server, inside the root account default password is empty, first set a password for root
#mysqladmin-u root password yourpassword

* Note: Although some special configuration can make phpMyAdmin allow null password login, but do not recommend this, especially the public network of servers.

2. Set PHP.ini to properly configure Session.save_path

1). First check the php.ini configuration file

#grep Session.save_path/etc/php.ini

If the following settings are not present, increase the configuration. If it is commented, remove the annotation

Session.save_path = "/var/lib/php/session"

2). See if the directory exists:

#ls/var/lib/php/session

If it does not exist, it is created manually
#mkdir/var/lib/php/session

# Modify directory owner for Nginx

Chown Nginx:nginx session/-R

# Reboot Start PHP-FPM

Service PHP-FPM Restart

Second, install the configuration phpMyAdmin

1. Download and extract to phpMyAdmin
Official download page: http://www.phpmyadmin.net/home_page/downloads.php
(Chinese users should choose to download all-languages version)

After the download is complete, unpack:

Unzip Phpmyadmin-4.1.12-all-languages.zip

Move to the appropriate directory location and change to a name that is easy to access:

MV Phpmyadmin-4.1.12-all-languages/www/phpmyadmin

2. Configure phpMyAdmin

To copy a configuration file:

#cd/www/phpmyadmin
#cp config.sample.inc.php config.inc.php

Configure config.inc.php
#vi config.inc.php

Set a secret key for internal use (related to internal encryption, no direct relationship to page login)

$cfg [' blowfish_secret '] = ' www.tudaxia.com ';

Third, configure the site under Nignx

Vi/etc/nginx/conf.d/phpmyadmin.conf

server {
 listen 8081;
 server_name localhost;
 Access_log/var/log/nginx/phpmyadmin-access.log main;

 Location/{
  root/www/phpmyadmin;
  Index index.php;
 }

 Location ~ \.php$ {
  root/www/phpmyadmin;
  Fastcgi_pass  Unix:/var/run/php-fpm/php-fpm.sock;
  Fastcgi_index index.php;
  Fastcgi_param script_filename $document _root$fastcgi_script_name;
  Include Fastcgi_params;
 }

 Location ~/\.ht {
  deny all;
 }
}

Reboot Nginx:

#service nginx Restart

Complete installation, Access http://yourserver:8081/, test phpMyAdmin.

Four, the phpmyadmin load slow to solve the method


The final reason for the slow loading of the phpmyadmin4.0 series is that recently phpMyAdmin's website is often not open, and the phpMyAdmin page will automatically check the official online version of the program update, So when you go into the phpMyAdmin Admin page and click on the database, phpMyAdmin has been trying to connect to the website to slow down the entire opening process.

The final solution is to not let phpMyAdmin check the update, find the phpMyAdmin directory version_check.php files, specific modifications as follows:

if (Isset ($_session[' cache '] [' Version_check '])
  && time () < $_session[' Cache '] [' version_check '] [' Timestamp '] + 3600 * 6
) {
  $save = false;
  $response = $_session[' cache '] [' version_check '] [' response '];
} else {
//  $save = true;  $file = ' Http://www.phpmyadmin.net/home_page/version.json ';  if (ini_get (' Allow_url_fopen ')) {
//    $response = file_get_contents ($file);  Else if (function_exists (' Curl_init ')) {
//    $curl _handle = Curl_init ($file);    curl_setopt ($curl _handle, Curlopt_returntransfer, 1);    $response = curl_exec ($curl _handle);
//  }
}

The above code is by annotating the else{...} The middle section to cancel phpMyAdmin Connection official website Version.json to check the update

After the modification, phpMyAdmin immediately returned to the second open.

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.