Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Solutions that cannot be used by phpMyAdmin in nginx+php-fpm mode

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article is about solutions that phpMyAdmin cannot use in nginx+php-fpm mode. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

Yesterday received a question from a netizen, said that yum installation nginx+php-fpm+mysql+phpMyAdmin, found that phpMyAdmin can not be opened, has been reported 502 error has been crazy for a long time, in line with the principle of helping others happy themselves, remotely help him take a look, now recorded and summarized as follows, the summary of problem-solving ideas is also the focus of this article.

Problem environment: nginx+php-fpm+mysql+phpMyAdmin installed by CentOS6 through yum

Problem description: after the installation is completed, it is found that there is no problem with nginx, but phpMyAdmin cannot be opened.

Problem solving process

View the installation package for the problem environment:

Nginx-filesystem-1.0.15-12.el6.noarchnginx-1.0.15-12.el6.x86_64rrdtool-php-1.3.8-7.el6.x86_64php-pear-1.9.4-4.el6.noarchphp-devel-5.3.3-46.el6_6.x86_64php-mbstring-5.3.3-46.el6_6.x86_64php-mcrypt-5.3.3-3.el6.x86_64php-5.3.3-46. El6_6.x86_64php-tidy-5.3.3-46.el6_6.x86_64php-pecl-memcache-3.0.5-4.el6.x86_64php-xmlrpc-5.3.3-46.el6_6.x86_64php-xmlseclibs-1.3.1-3.el6.noarchphp-common-5.3.3-46.el6_6.x86_64php-pdo-5.3.3-46.el6-6.x86-64phpmurxmlmur5.3.3- 46.el6_6.x86_64php-fpm-5.3.3-46.el6_6.x86_64php-cli-5.3.3-46.el6_6.x86_64php-mysql-5.3.3-46.el6_6.x86_64php-eaccelerator-0.9.6.1-1.el6.x86_64php-gd-5.3.3-46.el6_6.x86_64

According to the 502 error reported by nginx, it can be preliminarily judged that there is a problem with upstream. Before mentioning upstream, list the configuration file of nginx (without comments, I have raised the level at which nginx logs errors from the default level to info).

User nginx; worker_processes 1 error 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;}

Since no server is explicitly stated in this configuration file, you need to look at the default server file included in include / etc/nginx/conf.d/*.conf;, that is, / etc/nginx/conf.d/default.conf, and remove the comments

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.htl; 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 return 9000; fastcgi_index index.php; include fastcgi_params;}}

According to the preliminary judgment, there is really no problem with the configuration of this nginx, it should be the problem of php-fpm or php itself (narrow the scope of the problem).

Check the nginx log file (/ var/log/nginx/error.log) and find the following prompt to determine that it is the problem with php-fpm. Fastcgi is also an agent for upstream.

17:05:32 on 2015-08-14 [notice] 9645: 0: using the "epoll" event method 17:05:32 on 2015-08-14 [notice] 9645: 0: nginx/1.0.15 2015-08-14 17:05:32 [notice] 9645: built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) 17:05:32 on 2015-08-14 [notice] 9645: 0: OS: Linux 2.6.32-504 .el6.x86 _ 64 17:05:32 on 2015-08-14 [notice] 9645: getrlimit (RLIMIT_NOFILE): 65535 notice: 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 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] 964880: * 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" on 2015-08-14 17:11:23 [error] 9648pm 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" 17:11:33 on 2015-08-14 [info] 9648pm 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 and see if the php file is parsed correctly (further narrowing the problem)

It is found that php-fpm can parse the php file normally, and all the php components in it display normally.

Check the version of phpMyAdmin, check the documentation on the official website to see if php5.3.3 is supported, and find out that the current phpMyAdmin support, so it should not be a phpMyAdmin problem.

Start checking the php-fpm log (/ var/log/php-fpm/error.log) and find that it looks like this:

[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 obviously does not provide enough information to solve the problem, so modify some parameters of php-fpm and php.ini on the log level to raise the log level and get detailed error information.

Search for the log keyword in the configuration file, or modify it according to the document or data. Some 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 to redirect the standard output and error output of php worker from / dev/null to the main error log, namely / 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 = Onhtml_errors = On

Restart php-fpm again and find the detailed error in 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 php module EACCELERATOR is mentioned in the error message, so first determine if there is a problem with this module, so disable this module first by changing the suffix name of the / etc/php.d/eaccelerator.ini file, such as mv / etc/php.d/eaccelerator.ini / etc/php.d/eaccelerator.ini~, and then restart php-fpm, then check the results and find that the problem has been solved.

It may be the reason for the conflict between eaccelerator and phpMyAdmin, so you can disable this module if you want to use phpMyAdmin, or skip this package during installation.

Note: eAccelerator is a free and open source php accelerator, optimization and dynamic content caching, improve the cache performance of php scripts, so that PHP scripts in the compiled state, the server overhead is almost completely eliminated. It also optimizes scripts to speed up their execution. The implementation efficiency of PHP program code can be increased by 1-10 times. (from bdbk)

Summary of problem-solving ideas

Article 0, communication is the key to fault diagnosis, a detailed understanding of the problem, such as deployment plans, steps, what actions have been done, etc.

First, according to experience, nginx+php-fpm+phpMyAdmin is a solid combination, so it is judged that this is a case-by-case problem, not a batch problem, so start directly, log in to the system to view the installed software packages, nginx, php and phpMyAdmin versions are to be viewed, this step helps to preliminarily determine whether they are compatible with each other and whether there is an unrepaired bug based on the knowledge and experience they have mastered.

Second, execute nginx-t to check the configuration file of nginx for explicit errors, and check the running status of nginx

Third, execute php-fpm-t to check the configuration file of php-fpm for explicit errors, and check the running status of php-fpm

Fourth, check the error log, first check the nginx error log, because it is the "first scene", and then check the php-fpm log, because it is the "second scene"

Fifth, if the log prompt is obvious, follow the log prompt, modify the corresponding configuration file, and verify the problem again

Sixth, if there is still a problem, then this step is the most critical step to solve the problem, and you need to upgrade the logging level, which is why debug is called debugging, raising the log level of nginx to info (why not to debug,nginx compile with a-- debug option, which can be used in case of uncertainty), raise the log level of php to debug, and turn on all php debugging switches.

Seventh, after restarting nginx and php-fpm, the configuration file takes effect, reopen the web page to reproduce the problem, open the log again, modify the corresponding configuration file according to the log prompt, and verify the problem again.

Eighth, if repeated changes fail, you should consult the official manual and consult the official manual. The Google search will be Google search, and the feedback bug will feed back to bug. If it continues to fail, find a different way to solve the problem and find the correct solution, as follows:

Refer to the existing successful version combination, change the version combination or modify the configuration file to eliminate environmental differences, which is suitable for rapid problem solving.

Change yum installation to compile installation, or yum install fewer packages to minimize the scope of problems by minimizing installation, so as to identify problems, improve problem-solving ability, and apply to research and learning.

Thank you for reading! So much for the solutions that phpMyAdmin cannot use in nginx+php-fpm mode. I hope the above content can be of some help to you, so that you can learn more. If you think the article is good, you can share it and let more people see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report