phpMyAdmin Timeout Operation SQL Timeout

Source: Internet
Author: User
Tags configuration settings fpm php script terminates phpmyadmin

LNMP One-click installation package Environment:

Phpmyadmin login timeout (1440 seconds inactive), please log in again.

Vim/usr/local/php/ect/php.ini

Session.gc_maxlifetime = 3600

vim/home/wwwroot/default/phpmyadmin/libraries/config.default.php

$cfg [' logincookievalidity '] = 3600;

phpMyAdmin time-out when performing MySQL operation:

Vim/usr/local/nginx/conf/nginx.conf

   Fastcgi_connect_timeout       300 ; //         time changed to-  fastcgi_send_timeout          300 ; //         time changed to-   Fastcgi_read_timeout          300 ; //  time changed to-         fastcgi_buffer_size 64k;        Fastcgi_buffers  4   64k;        Fastcgi_busy_buffers_size 128k; Fastcgi_temp_file_write_size 256k;  

When the above 3 values are marked red, the main is read and send two (the default Nginx timeout is 300), which solves the 504 error perfectly.
And can be configured at the Http,server level, or can be configured at the location level.
Factcgi_connect_{read|send|timeout} is valid for Fastcgi_pass; Proxy_connect_{read|send|timeout} is in effect for Proxy_pass

502 Error occurred while performing SQL operation for Myphpadmin

View PHP-FPM's log: Tail/usr/local/php/var/log/php-fpm.log

[ in-sep- .  -: +: -] WARNING: [Pool www] Child21887, script'/home/wwwroot/default/phpmyadmin/sql.php'(Request:"get/phpmyadmin/sql.php") Execution timed out (125.496217sec), terminating[ in-sep- .  -: +: -] WARNING: [Pool www] Child21887Exited on signal the(SIGTERM) after87935.416668seconds from start[ in-sep- .  -: +: -] NOTICE: [Pool www] Child32379Started

Vim/usr/local/php/etc/php-fpm.conf

PM = dynamic         
 Pm.max_children = 80//Important parameter: A process starts at 3M for a period of time probably 20-30m according to its own configuration settings, memory to leave half to mysql
    pm.start_servers  = 40  pm.min_spare_servers  = 40  pm.max_spare _servers  = 80  request_terminate_timeout  = 100  // 0 for unlimited, I changed to 0  request_slowlog_timeout = 0   = Var/log/slow.log 

If set to static, the number of processes is pm.max_children specified from start to finish, and the Pm.start_servers,pm.min_spare_servers,pm.max_spare_servers configuration will have no effect. If set to dynamic, the number of processes is dynamically, starting with the number specified by Pm.start_servers, and automatically incremented if more requests are made, but not exceeding the number specified by Pm.max_children, while ensuring that the number of idle processes is not less than pm.min_ Spare_servers, if the number of processes is large, the corresponding cleanup will be done to ensure that the number of redundant processes is not more than pm.max_spare_servers. When the PHP-FPM is started, a php-cgi process is about 3 m of memory, but when they have processed some requests, some of the memory is not released and the memory can be up to 20m-30m.

Large memory can be set to static, php-fpm do not have to create the process repeatedly. Some people say that high performance can be set to dynamic, low performance allocation control fixed process.

It took about 5 minutes for the index to be deleted before the two parameters were changed. It is estimated that request_terminate_timeout is the one that has influence

Solutions

Request_terminate_timeout value in Max_execution_time value php-fpm.conf in php.ini
Both of these are used to configure the maximum execution time for PHP scripts. When timed out, php-fpm terminates execution of the script and terminates the worker process that executed the script. As above, php-fpm child 18822 was terminate after regenerating a new worker process 19164, so nginx found that the connection with their own communication is broken, it will naturally return 502 error to the client. The client needs to re-initiate a request to reestablish a new connection, and the appearance is to restart the request by refreshing the browser

So simply increase the value of these two items appropriately, so that the PHP script will not be terminated because of the long execution time and the connection with Nginx activation is lost.

Request_terminate_timeout priority is higher than max_execution_time, do not want to change the global php.ini, only change the configuration of php-fpm can be. We'll be here in 600 seconds.

Request_terminate_timeout = 600

add: Nginx also pay attention to the upstream module max_fail and Fail_timeout. Sometimes nginx and back-end server (Tomcat, FastCGI) communication is only accidental disconnection, but the max_fail setting is too small, then in the next fail_timeout time, Nginx will assume that the backend server is unresponsive, will return 502 error. So you can turn the max_fail up a little bit and make the fail_timeout smaller.

The AMH profile of the pit daddy is here:

/usr/local/nginx-generic-1.6/conf/nginx.conf

/home/wwwroot/web/php-fpm/Domain name directory. conf

/home/wwwroot/web/etc/amh-php.ini

The web is the name of the environment under AMH, which can have multiple virtual hosts

Tutorial Source:

Http://www.2cto.com/os/201301/184035.html

http://ju.outofmemory.cn/entry/251073

phpMyAdmin Timeout Operation SQL Timeout

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.