Articles of php fpm

nginx日志php-fpm的stderr输出在看似随机的位置被切断

自从我开始使用一个产生一个长的调用链的PHP库之后,debugging它的问题就变得越来越困难了,因为我的错误日志最终包含这样的输出结果:( 一些值已经被*清空了) 2017/08/23 10:47:26 [error] 13057#13057: *206119 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught ActiveRecord\DatabaseException: PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "" in /var/www/********/vendor/php-activerecord/php-activerecord/lib/Connection.php:337 Stack trace: #0 /var/www/********/vendor/php-activerecord/php-activerecord/lib/Connection.php(337): PDOStatement->execute(Array) #1 /var/www/********/vendor/php-activerecord/php-activerecord/lib/Table.php(237): ActiveRecord\Connection->query('SELECT * FROM "…', Array) #2 /var/www/********/vendor/php-activerecord/php-activerecord/lib/Table.php(219): ActiveRecord\Table->find_by_sql('SELECT * FROM "…', Array, false, NULL) #3 […]

Nginx不匹配path位置

我正在尝试做基于位置的Fastcgi服务器。 所有请求/ api / v1 / – >服务器v1:9000和/ api / v2 / – >服务器v2:9000我的nginxconfiguration是 server { listen 80; index index.php index.html; root /var/www/public; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass v1:9000; if ( $uri ~ "^/api/v1/") { fastcgi_pass v1:9000; } if ( $uri ~ "^/api/v2/") { fastcgi_pass v2:9000; } fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME […]

使用nGinx作为新路由路由到子目录

这是我目前的服务器块(下面)。 我有一个单独的WordPress博客安装在/博客,需要路由/博客目录“/ home / forge / example.com/public/blog”。 我已经尝试了几个选项,并感到遗憾,所以任何意见都感激地收到。 # FORGE CONFIG (DOT NOT REMOVE!) include forge-conf/example.com/before/*; server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name example.com; root /home/forge/example.com/public; # FORGE SSL (DO NOT REMOVE!) ssl_certificate /etc/nginx/ssl/example.com/server.crt; ssl_certificate_key /etc/nginx/ssl/example.com/server.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers 'REMOVED FOR DEMO'; ssl_prefer_server_ciphers on; ssl_dhparam /etc/nginx/dhparams.pem; add_header X-Frame-Options "SAMEORIGIN"; […]

nginx + fpm +子目录

我有一个看起来像这样的nginxconfiguration: location ^~ /movies { alias /var/dp.cx/movies/current/public; fastcgi_index index.php; try_files $uri /movies/index.php; location ~* \.php { fastcgi_pass unix:/run/php/php7.1-fpm.sock; fastcgi_split_path_info ^(.+\.php)(.*)$; include /etc/nginx/fastcgi_params; } } 这是一个Laravel应用程序,几乎完全开箱即用。 但是,这个configuration有一些小问题。 击中/movies触发一个404.击中/movies/工程成功。 打到其中一个分页URL( /movies/test?page=2 )没有来自查询string的信息。 我不知道我在哪里find了这个configuration,但是它似乎是我用nginx + fpm和子目录URLfind的“工作”configuration最接近的。

如何以及在哪里configuration使用Docker的php-fpm的pm.max_children?

在一个使用Nginx和PHP-FPM的Web应用程序中,我注意到了缓慢的时刻和分析日志,我发现这个消息不时出现: [19-Nov-2017 19:24:09] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it 经过一番研究之后,我增加了php.iniconfiguration文件中的值, 停止并移除了php容器并重build它 ,因为设置为卷上的文件的设置已经生效。 分析容器中的configuration文件,它与我设置的新值相关,但是关于pm.max_children(5)的错误消息继续出现。 Here is my docker-compose.yml version: '2' services: pi_web: build: ./nginx ports: – "80:80" – "443:443" volumes: – ../src:/src – ./nginx/conf.d:/etc/nginx/conf.d – ./nginx/nginx.conf:/etc/nginx/nginx.conf – /etc/letsencrypt:/etc/letsencrypt pi_php: build: ./php volumes: – ../src:/src – ./php/config/php.ini:/usr/local/etc/php/php.ini 这是./php/config/php.ini的一个片段: pm = dynamic pm.max_children […]

PHP-FPM + NGINX:PHP-CGI进程在闲置一段时间后死机,然后502坏的网关和手动重启需要

我目前正在build立一个VPS(与VPS.NET),我将用它来主持一个博客和一些其他的东西。 我已经安装了nginx,并用php-fpm修补了php(5.2.8)。 所有的工作都非常棒(而且速度非常快),除了一个恼人的问题:因为现在网站没有其他的stream量,一段时间以后,它一直处于空闲状态,所有的php-cgi进程都会死掉。 只要我尝试访问网站,nginx返回一个不错的“502坏的网关”,并修复我必须手动重新启动php-fpm才能使网站再次工作。 这是为什么? 我已经看到这是一个普遍的问题,但是在空闲时间寻找解决办法的几天之后,我发现没有任何东西对我有效。 有什么build议么? 提前致谢

PHP-FPM非常高的处理器使用率

我在运行Debian Lenny x86_64的服务器上使用了一堆nginx + php-fpm。 有时PHP-FPM的进程会以100%的速度加载全部8个内核,并且直到强制重新启动PHP-FPM,这个负载才会下降。 我怎样才能确定这样的跳跃负载的问题是什么? 在PHP-FPM的日志中没有什么不寻常的。 PHP版本 – 5.3.3。

识别瓶颈

所以我在云端服务器上有nginx和php-fpm。 使用这些设置的Apache基准: ab -n 300 -c 5 http://example.com/ 所以云服务器(从机架空间)是一个256MB的。 我跑了htop而Apache基准进行,所以我可以看到服务器资源。 所有四个处理器(我是否只有四个单独的处理器的一部分在机架空间?我不知道我有多less访问)是100%(或98%或某种程度上高)整个时间的Apache基准是运行。 目前我每秒获得15个请求。 我的第一个想法是调整服务器的大小(我把它改成512MB的,所以它应该是所有东西的两倍)。 尽pipe如此,每秒的请求数也完全相同,处理器使用率一直处于/接近100%。 然后我试着改变php-fpm有一个静态的20个进程(而不是10个)。 这和以前一样的结果。 这个瓶颈会是什么? 我在这个特定的页面上的一般应用程序(用PHP编写)只是连接到一个数据库,并得到一个产品列表。 然后把它们列在一张表中。 不是很多复杂的查询(虽然有很多) 那么也许它是数据库相关的?

mod_rewrite总是给出10个内部redirect并失败

我有一个简单的.htaccess,由于某种原因无法正确redirect: RewriteEngine on RewriteBase / RewriteRule ^.*$ /test.php [L] 有一个日志条目: [Tue Nov 16 17:04:12 2010] [error] [client 213.141.155.85] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. [Tue Nov 16 17:04:12 2010] [debug] core.c(3053): [client 213.141.155.85] […]

限制APC操作码caching到特定的网站? Nginx + PHP-FPM + APC

有没有办法在每个虚拟主机的基础上启用/禁用APC? 我宁愿不要使用宝贵的APC共享内存caching我的PHPmyAdmin子域或较less使用的网站。 安装程序是Nginx,php-fpm和apc。 从我读过APC的filter设置无法匹配完整path,所以我正在寻找其他方法。