Articles of php fpm

Nginx / PHP5-FPM主进程 – CPU使用率高

我一直有一些奇怪的问题与PHP-FPM和主进程中的高CPU使用率。 由于我们有很多网站,所以通常我的stream量会出现CPU峰值,但是我也使用Varnish进行高速caching,所有的负载均衡。 当出现这些尖峰时,htop报告主进程跳转到99-100%的CPU,而某些单独的PHP池进程的CPU使用率保持相当低。 这里是htop的截图: 我已经尝试将pm.max_requests调整为不同的值,但是当pm.max_requests设置为低时,问题似乎变得更糟,这使我怀疑是否高主进程CPU使用率可能是由进程重新生成引起的。 现在我有Monit监视进程,并且每当CPU爆发15分钟以上时就重新启动进程。 重新启动php-fpm可以摆脱高CPU占用率。 环境信息: 操作系统:Ubuntu 14.04 代理/caching服务器:清漆4.1 Web服务器:Nginx 1.8.1 PHP版本:5.6.20-1 PHP-fpm.conf: ; FPM Configuration ; ;;;;;;;;;;;;;;;;;;;;; ; All relative paths in this configuration file are relative to PHP's install ; prefix (/usr). This prefix can be dynamically changed by using the ; '-p' argument from the command line. ; Include one […]

当重写uri时,nginx防止POST参数丢失

我想用php-fpm在nginx上做一些url重写。 也就是说,将所有请求路由到php脚本,如下所示: /index.php?fulluri=(originaluri) 许多方法来解决这个问题: Nginx – 将所有请求路由到单个脚本 https://stackoverflow.com/questions/18735657/nginx-conf-for-url-routing 任务是,做任何这些解决scheme保存POST参数和cookie以便在目标index.php脚本中稍后处理? 我觉得fastcgi_param SCRIPT_FILENAME $document_root/index.php?fulluri=$request_uri; 会工作,但我不能现在testing,想做任何修改之前有一些信息。

MongoDB或mongoclient不closures连接

我有一个与我们的mongodb服务器有太多的连接打开问题。 我们已经跟踪到与PHP服务器的vhost传入连接有关的问题。 sudo lsof | grep mongod | grep TCP | grep ESTABLISHED | grep -c '10.0.0.40' 获得大约8000个开放连接。 在PHP虚拟主机上,只有40个连接对数据库虚拟主机开放 sudo lsof | grep -c '10.0.0.60' 我们试图用tcp kill来强制closures连接,但是他们不断的回来。 为什么mongo vhost有这么多的开放连接,实际上应该只有40个? 我如何使mongodbclosures挂起的现有连接? 如何findPHP服务器端的罪魁祸首? php5-fpm是否支持连接poooling?

PHP的错误似乎很忙(你可能需要增加pm.start_servers,或pm.min / max_spare_servers)

我在我的专用服务器中使用了ubuntu 15.04,其中有40个cpu核心和160GB的RAM,其中一个stream量大的wordpress站点正在运行。 我使用Nginx作为Web服务器和清漆作为caching服务器。 我的php5-fpm.conf设置是: listen = 127.0.0.1:7654 pm = dynamic pm.max_children = 500 pm.start_servers = 80 pm.min_spare_servers = 20 pm.max_spare_servers = 160 pm.max_requests = 1000 但它仍然显示错误: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 17 idle, and 92 total children WARNING: [pool www] server reached pm.max_children […]

听127.0.0.1:9000,但var / run / php5-fpm.sock失败(2:没有这样的文件或目录)

我有一个networking服务器configuration为接受像下面的127.0.0.1:9000 FastCGI请求。 /etc/php5/fpm/pool.d/www.conf : listen = 127.0.0.1:9000 / etc / nginx / sites-enabled / mysite : location ~ .php$ { if (!-e $request_filename) { rewrite / /index.php last; } expires off; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param MAGE_RUN_CODE $mage_code; fastcgi_param MAGE_RUN_TYPE $mage_type; include fastcgi_params; } 但是,我正在看Nginx的错误日志,我不断收到此错误: connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or […]

NGINX访问错误path中的文件

我有一个codeigniter应用程序具有以下目录结构 <HOME> |_ <web> | |_<API> | |_index.php |_<admin> 开发人员在目录中有一个index.html。 codeigniter文件和开发人员推出的服务都在目录中。 开发人员通过将服务名称附加到域来访问服务,如下所示:http://mydomain/web/API/index.php/v1/GetRoles主机名在JavaScript文件中被configuration为BASE PATHvariables。 这个程序是由运行fast-CGI的NGINX服务的。 虽然HTML页面被加载,但是没有数据被获取。 所以我们试图通过在浏览器中inputURL( http://mydomain/web/API/index.php/v1/GetRoles )来访问这些函数。 我们得到一个404 Not Found错误。 错误日志包含以下条目 2016/05/20 16:14:57 [error] 2127#0: *232 FastCGI sent in stderr: "Unable to open primary script: /home/myname/public_html/domainname/public/projectname/index.php (No such file or directory)" while reading response header from upstream, client: 14.141.163.46, server: mydomain.com, request: "GET /web/API/v1/get/Common/GetActivities […]

nginx:在stderr中发送的FastCGI:“主脚本未知”

在64位的arch linux上使用最新版本的nginx(1.10.0)和php-fpm(PHP 7.0.6)。 当试图请求index.php DokuWiki安装,我得到以下错误: 2016/05/21 22:09:50 [error] 11099#11099: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.70.3, server: doku.test.com, request: "GET /install.php HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "doku.test.com" 这里是相关的服务器configuration: server { listen 80; server_name doku.test.com; root /var/www/doku/public_html/; access_log /var/log/nginx/scripts.log scripts; location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/run/php-fpm/php-fpm.sock; […]

从mac的xdebug远程centos主机

我有一台运行CentOS7的服务器,php-fpm是PHP7.0.7,还有一个是SELinux。 我正在尝试debugging在该服务器上运行的PHP脚本。 我有一台运行PHP风暴的Mac机器,我打算进行debugging。 我遵循这个指南Phpstorm。 以下是我所做的: 1)安装xdebug到服务器 2)设置xdebugconfiguration如下: 的zend_extension = “的/ usr / lib64下/ PHP /模块/ xdebug.so” xdebug.remote_enable = 1 xdebug.remote_host = “localhost” 的 xdebug.remote_port = 9099 xdebug.remote_handler = dbgp xdebug.remote_autostart = 1 xdebug.idekey = “PHPSTORM” 3)设置sshconfiguration有:AllowTcpForwarding是(我然后恢复它,因为它没有帮助) 4)重新启动php-fpm,sshd和httpd 5)在我的本地terminal,打开ssh连接到指定-R标志的服务器 $ ssh -R 9099:localhost:9099 user @ host 6)改变我的phpstorm中的xdebugconfiguration来监听端口9099,并在index.php中设置一个断点 7)在我的浏览器中打开网站 但是我的本地xdebug并没有停在断点处。 我在configuration中可能会丢失什么? 难道是SElinux阻止debugging吗?

CentOS 7上的PHP7 + OpenSSL-1.0.2h

自从昨天以来,我已经将OpenSSL-1.0.2h应用于我的Nginx服务器,我从源代码重新编译。 对于OpenSSL部分,我已经遵循了这个指南: https : //syslint.com/blog/tutorial/how-to-upgrade-openssl-on-centos-7-or-rhel-7/ 。 事后编译Nginx比较容易: ./configure –prefix=/etc/nginx … –with-openssl=/usr/local/src/openssl-1.0.2h 背景信息 $ openssl version OpenSSL 1.0.2h 3 May 2016 $ which openssl /usr/bin/openssl $ ls /usr/bin/openssl /usr/bin/openssl -> /usr/local/ssl/bin/openssl $ find / -name "openssl" … /usr/include/openssl /usr/local/src/openssl-1.0.2h/apps/openssl /usr/local/src/openssl-1.0.2h/include/openssl /usr/local/src/openssl-1.0.2h/.openssl/include/openssl /usr/local/src/openssl-1.0.2h/.openssl/bin/openssl /usr/local/ssl/include/openssl /usr/local/ssl/bin/openssl … $ nginx -V nginx version: nginx/1.11.1 built by gcc 4.8.5 20150623 […]

.htaccess文件未加载PHP文件

我正在努力解决为什么加载.php文件时,我的.htaccess没有被考虑。 下面的文件坐在我的本地主机的webroot。 的.htaccess # Cause a HTTP 500 test file.html <html><body><h1>This should not show</h1></body></html> file.php <html><body><h1>This should not show</h1></body></html> 当我访问/index.html时,我得到预期的HTTP500当我访问/index.php时,html显示。 任何想法为什么.htaccess不会加载的PHP文件? Apache 2.4.6 VHost(/etc/httpd/vhosts.d/website.local.conf): <VirtualHost *:443> ServerName website.local ServerAlias www.website.local DocumentRoot /var/www/vhosts/website/website <Directory /var/www/vhosts/website/website> require all granted Options Indexes FollowSymLinks AllowOverride All </Directory> # Trigger PHP-FPM to run PHP execution <IfModule proxy_fcgi_module> ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/var/www/vhosts/website/php-fpm.sock|fcgi://website/var/www/vhosts/website/website" […]