This article mainly introduces how to install and configure PHPMyAdmin on the Nginx server. it comes with a solution to slow loading of PHPMyAdmin. For more information, see
I. preparations:
1. if the root account of mysql is empty, you need to set the root password.
The default mysql server installed in CentOS. the default password of the root account is null. first, set a password for the root account.
# Mysqladmin-u root password yourpassword
* Note: Although some special configurations allow phpmyadmin to allow empty passwords to log on, it is not recommended to do so, especially for public network servers.
2. set php. ini to correctly configure session. save_path
1) first, check the php. ini configuration file.
#grep session.save_path /etc/php.ini
If the following settings do not exist, add them. If commented out, remove the comment
session.save_path = “/var/lib/php/session”
2) Check whether the directory exists:
#ls /var/lib/php/session
If not, manually create
#mkdir /var/lib/php/session
# Change the directory owner to nginx
chown nginx:nginx session/ -R
# Restart and start php-fpm
service php-fpm restart
II. install and configure phpmyadmin
1. download and decompress the package to phpmyadmin.
Official Download Page: http://www.phpmyadmin.net/home_page/downloads.php
(Chinese users should select to download all-versions)
After the download is complete, decompress:
unzip phpMyAdmin-4.1.12-all-languages.zip
Move to the corresponding directory location and change it to a name that is easy to access:
mv phpMyAdmin-4.1.12-all-languages /www/phpmyadmin
2. configure phpmyadmin
Copy a configuration file:
#cd /www/phpmyadmin#cp config.sample.inc.php config.inc.php
Configure config. inc. php
#vi config.inc.php
Set an internal key (it is related to internal encryption and is not directly related to page logon)
$cfg['blowfish_secret'] = ‘www.tudaxia.com';
3. configure sites under the nginx
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; }}
Restart nginx:
#service nginx restart
Complete the installation and access http: // yourserver: 8081/to test phpmyadmin.
4. slow loading of phpmyadmin
The final cause of slow loading of phpmyadmin4.0 series is that phpmyadmin's official website is not frequently opened recently, and The phpmyadmin page automatically checks the official online program version updates, so when you go to the phpmyadmin management page and click the database, phpmyadmin keeps trying to connect to the official website, which slows down the entire open process.
The final solution is to prevent phpmyadmin from checking for updates and find the version_check.php file in the phpmyadmin Directory. the specific modification is 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 to cancel the phpmyadmin connection to the official website version. json by commenting out the section in the middle of else {...} to check for updates
After the modification, phpmyadmin immediately returns to the second.