Yesterday received a Netizen's question, said Yum installed nginx+php-fpm+mysql+phpmyadmin, found that phpMyAdmin can not open, has been reported 502 errors have been crazy half a day, in the spirit of helping others happy their principles, remote help him to see a bit, It is recorded and summarized as follows, the problem-solving ideas in the end of the article, the problem-solving thinking summary is the focus of this article.
Problem Environment: CentOS6 nginx+php-fpm+mysql+phpmyadmin installed by Yum
problem Description: after installation, found Nginx no problem, and phpMyAdmin cannot open, prompt 502 error
Problem solving Process
To view the installation package for the problem environment:
Nginx-filesystem-1.0.15-12.el6.noarch |
Nginx-1.0.15-12.el6.x86_64 |
Rrdtool-php-1.3.8-7.el6.x86_64 |
Php-pear-1.9.4-4.el6.noarch |
Php-devel-5.3.3-46.el6_6.x86_64 |
Php-mbstring-5.3.3-46.el6_6.x86_64 |
Php-mcrypt-5.3.3-3.el6.x86_64 |
Php-5.3.3-46.el6_6.x86_64 |
Php-tidy-5.3.3-46.el6_6.x86_64 |
Php-pecl-memcache-3.0.5-4.el6.x86_64 |
Php-xmlrpc-5.3.3-46.el6_6.x86_64 |
Php-xmlseclibs-1.3.1-3.el6.noarch |
Php-common-5.3.3-46.el6_6.x86_64 |
Php-pdo-5.3.3-46.el6_6.x86_64 |
Php-xml-5.3.3-46.el6_6.x86_64 |
Php-fpm-5.3.3-46.el6_6.x86_64 |
Php-cli-5.3.3-46.el6_6.x86_64 |
Php-mysql-5.3.3-46.el6_6.x86_64 |
Php-eaccelerator-0.9.6.1-1.el6.x86_64 |
Php-gd-5.3.3-46.el6_6.x86_64 |
According to the Nginx report 502 error, you can initially determine that upstream has a problem, before referring to upstream, first list the Nginx configuration file (remove the comments, I have the Nginx record error log level from the default level to info).
user nginx; worker_processes 1;error_log /var/log/nginx/error.log info;pid /var/run/nginx.pid;events { worker_connections 1024; }http { include /etc/nginx/mime.types; default_type application/octet-stream; client_max_body_ size 10m; log_format main ' $remote _addr - $remote _ user [$time _local] "$request" " ' $status $body _ bytes_sent "$http _referer" " "$http _user_agent" "$http _x_forwarded_for" '; access_log /var/log/nginx/access.log main; Sendfile on; keepalive _timeout 65; include /etc/nginx/conf.d/*.conf;}
Because no server is explicitly stated in this configuration file, you need to look at include/etc/nginx/conf.d/*.conf; The included default server file, which is/etc/nginx/conf.d/ default.conf, remove the comment
cat /etc/nginx/conf.d/default.conf server { listen 80 default_server; server_name _; include /etc/ nginx/default.d/*.conf; location / { root /usr/share/nginx/html; index index.php index.html index.htm; } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; } error_ page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ [^/]\.php (/|$) { fastcgi_split_path_info ^ (. +?\.php) (/.*) $; if (!-f $document _root$fastcgi_script_name) { return 404; } fastcgi_pass 127.0.0.1:9000; fastcgi_ index index.php; include fastcgi_params; } }
Preliminary judgment, this nginx configuration is really no problem, it should be php-fpm or PHP itself problem (narrow the problem scope).
Check nginx log file (/var/log/nginx/error.log), found the following hints, to determine the problem is PHP-FPM, fastcgi is also a proxy for upstream
2015/08/14 17:05:32 [notice] 9645#0: using the "Epoll" event method 2015/08/14 17:05:32 [notice] 9645#0: nginx/1.0.15 2015/08/14 17:05:32 [notice] 9645#0: built by gcc 4.4.7 20120313 (red hat 4.4.7-11) (GCC) 2015/08/14 17:05:32 [ notice] 9645#0: os: linux 2.6.32-504.el6.x86_64 2015/08/14 17:05:32 [notice] 9645#0: getrlimit (Rlimit_nofile): 65535:65535 2015/08/14 17:05:32 [notice] 9646#0: start worker processes 2015/08/14 17:05:32 [notice] 9646#0: start worker process 9648    2015/08/14 17:05:36 [ERROR] 9648#0: *1 RECV () failed (104 : connection reset&nbsP;by peer) while reading response header from upstream, client: 192.168.1.228, server: 192.168.1.101, request: "get / http/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.101" 2015/08/14 17:09:22 [ERROR] 9648#0: *4 RECV () failed (104: connection reset By peer) while reading response header from upstream, client: 192.168.1.228, server: 192.168.1.101, request: "get / http/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.101" 2015/08/14 17:11:23 [ERROR] 9648#0: *7 RECV () failed (104: connection reset By peer) while reading response header from upstream, client: 192.168.1.228, server: 192.168.1.101, request: "get / http/1.1", upstream: "fastcgi:// 127.0.0.1:9000 ", host: " 192.168.1.101 " 2015/08/14 17:11:33 [info] 9648#0: *9 client closed prematurely connection while reading Client request line, client: 192.168.1.228, server: 192.168.1.101
Create a file that opens Phpinfo to see if the php file resolves correctly (further narrowing the problem)
Found that PHP-FPM can parse PHP files normally, the inside of the various PHP components are displayed normal
Check the version of phpMyAdmin, check the official website's documentation to see if it supports php5.3.3, discover current phpmyadmin support, and therefore should not be a phpmyadmin issue
Start checking php-fpm's log (/var/log/php-fpm/error.log) and find the following:
[14-aug-2015 16:34:53] notice: fpm is running, pid 9522 [ 14-aug-2015 16:34:53] notice: ready to handle connections [14-aug-2015 16:43:54] warning: [pool www] child 9527 exited on signal 11 (SIGSEGV) after 541.401349 seconds from start [14-aug-2015 16:43:55] notice: [pool www] child 9614 started [14-aug-2015 16:44:00] warning: [pool www] child 9526 exited on signal 11 (SIGSEGV) after 547.107407 seconds from start [14-aug-2015 16:44:00] notice: [pool www] child  9615 STARTED    [14-AUG-2015 17:05:36] WARNING: [POOL WWW] child 9523 exited on signal 11 (SIGSEGV) after 1843.098829 seconds from start [14-Aug-2015 17:05:36] NOTICE: [pool www] child 9649 Started
This log is obviously not sufficient to provide sufficient information to resolve the problem, so modify PHP-FPM and php.ini to configure some of the log level parameters to raise the log level for detailed error information.
Search for the Log keyword in the configuration file, or modify it according to the document or material, some of the methods or steps are as follows:
/etc/php-fpm.conf file, change the log level from notice to debug
Log_level = Debug
/etc/php-fpm.d/www.conf file that redirects the standard output and error output of the PHP worker from/dev/null to the primary error log, which is/var/log/php-fpm/error.log
Catch_workers_output = yes
/etc/php.ini file
error_reporting = e_all & ~e_deprecateddisplay_errors = ondisplay_startup_errors = Onlog_errors = Ontrack_errors = Onh Tml_errors = On
Restart PHP-FPM again to find detailed errors in the worker:
[14-aug-2015 17:09:18] notice: fpm is running, pid 9672 [ 14-aug-2015 17:09:18] notice: ready to handle connections [14-aug-2015 17:09:22] warning: [pool www] child 9673 said into stderr: "[fri aug 14 17:09:22 2015" [14-Aug-2015 17:09:22] warning: [pool www] child 9673 said into stderr: "] [notice] eaccelerator (9673): php crashed on opline 30 of pma_url _getcommon () at /usr/share/nginx/html/libraries/url_generating.lib.php:188 " [ 14-aug-2015 17:09:22] warning: [pool www] child 9673 said into stderr: "" [14-Aug-2015 17:09:22] WARNING: [pool www] child 9673 exited on signal 11 (SIGSEGV) after 4.286828 seconds from start [14-Aug-2015 17:09:22] NOTICE: [pool www] child 9679 started [14-aug-2015 17:11:23] warning: [pool www] child 9675 said into stderr: "[fri aug 14 17:11:23 2015" [14-aug-2015 17:11:23] warning: [pool www] child 9675 said into stderr: "] [notice] eaccelerator (9675): php crashed on opline 30 of pma_url_getcommon () at /usr/share/nginx/html/libraries/url_generating.lib.php:188 "
The error message mentions eaccelerator this PHP module, so first determine whether it is due to the problem of this module, so first disable this module by changing the/etc/php.d/eaccelerator.ini file suffix name, for example mv/etc/ php.d/eaccelerator.ini/etc/php.d/eaccelerator.ini~, then restart PHP-FPM, and then check the results, found that the problem has been resolved.
This may be the cause of the conflict between Eaccelerator and phpMyAdmin, so you can disable this module if you want to use phpMyAdmin, or skip the package during installation.
Note: Eaccelerator is a free open source PHP accelerator, optimized and dynamic content caching, which improves the caching performance of PHP scripts, allowing PHP scripts to be almost completely eliminated from the server in the compiled state. It also has the effect of optimizing the script to speed up its execution efficiency. Increase the efficiency of PHP program code by up to 1-10 times. (from BDBK)
Summary of problem-solving ideas
No. 0, communication is the key to diagnose the failure, detailed understanding of the problem, such as the deployment plan, steps, what to do and so on
First, based on experience, Nginx+php-fpm+phpmyadmin is a very strong combination, so judge this is a case problem, not a batch problem, so go directly to the system to see the installed packages, Nginx, Both PHP and phpMyAdmin versions are to be viewed, and this step helps to determine, based on knowledge and experience, whether they are compatible with each other, whether there are any bug fixes or not.
Second, perform nginx-t check nginx configuration file has no explicit error, check nginx running state
Third, perform php-fpm-t check php-fpm configuration file has no explicit error, check the running state of PHP-FPM
Four, check the error log, first check nginx error log, because it is "first scene", and then check the PHP-FPM log, because it is "second scene"
If the log prompt is obvious, follow the log prompts, modify the appropriate configuration file, and verify the problem again
Six, if there is still a problem, this step is the most critical step to solve the problem, need to improve the level of logging, which is why debug is called Debugging , the Nginx log level to the info (why not upgrade to debug, Nginx compile with a--debug option, can not be used when unsure, the PHP log level to debug, open all the PHP debug switch
Seven, after restarting Nginx and PHP-FPM, the configuration file takes effect, re-open the webpage reproduce the problem, open the log again, according to the log prompt content again, modify the corresponding configuration file, re-verify the problem
The last, if the review of the official manual after repeated changes, the official manual, the Google search on Google search, the feedback bug feedback bug, if it persists, then the way to solve the problem, look for the correct solution, the following:
Refer to the existing successful version combinations, change the version mix or modify the configuration file to eliminate environmental differences and apply to quickly solve problems
Change the yum installation to a compiled installation, or yum to install fewer packages to minimize problem areas with minimal installation to identify problems, improve problem solving, and apply to research and learning
Finally added: As long as the problems can be reproduced, rather than randomly appear, it will be able to solve the problem, so do not panic, do not impetuous, not to give up, and even slow down after the calm treatment.
--end--
This article is from "Communication, My Favorites" blog, please make sure to keep this source http://dgd2010.blog.51cto.com/1539422/1684839
Troubleshoot issues that phpMyAdmin cannot use in NGINX+PHP-FPM mode