Articles of PHP的FMP

WordPress的Nginx PHP-FPM超时POST请求

我有一个庞大的数据库和大量的观众访问WordPress的安装。 我正在使用PHP-FPM和Nginx的Ubuntu服务器。 该网站运行几乎完美,除了人们试图在网站上发布一个post。 当有人在网站上提交post时,需要很长的时间,然后给他们留言: 过了一段时间,它会发布。 这是非常繁琐的,但是因为很多职位都想提出来。 这是我的nginxconfiguration: events { worker_connections 1024; use epoll; multi_accept on; } http { ## # EasyEngine Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 2; keepalive_requests 100000; types_hash_max_size 2048; server_tokens off; reset_timedout_connection on; add_header X-Powered-By "EasyEngine 3.7.4"; add_header rt-Fastcgi-Cache $upstream_cache_status; # Limit Request limit_req_status 403; limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; […]

无法重新启动php7.0-fpm。 儿童进程挂

要清除我的PHP应用程序的opcache,我希望能够重新启动php7.0-fpm.service 。 我使用Ubuntu 17.04(Zesty Zapus),nginx / 1.10.3和php-fpm7.0。 在服务器上,我正在通过gluster挂载一个文件系统。 当我的应用程序运行一段时间,我尝试重新启动php-fpm与systemctl restart php7.0-fpm.service它需要很长时间来终止命令。 之后,PHP的FPM不会再次启动。 systemctl restart php7.0-fpm.service Job for php7.0-fpm.service failed because the control process exited with error code. See "systemctl status php7.0-fpm.service" and "journalctl -xe" for details. 重启之前的进程列表: root 819 0.0 1.4 366356 58764 ? Ss Jul10 0:02 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf) www-data 23129 0.0 0.8 […]

PHP脚本不能从子目录执行

这是情况。 我已经在运行Ajenti的ubuntu 14.04虚拟机上安装了prestashop 1.7.1,所以我的php-fpm和nginx。 看了很多教程和一些自定义configuration后,我设法让一切正常工作。 然而,我只是安装了一个新的模块,当调用的PHP文件,工作(生成XML)我服务的文件,而不是proccessed结果。我检查了文件的权限,我什至尝试所有文件777。 我已经注意到问题出在哪,yginx的configuration是: set $admin_dir /admin_folder; gzip on; gzip_vary on; gzip_proxied any; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # Supposed to be the case but we never know # text/html; gzip_disable "MSIE […]

无法在ubuntu 14.04上运行PHP 7.1

我已经安装了php 5.6.30,并在ubuntu 14.04.5上与nginx 1.12.1一起运行 我想运行laravel 5.5,所以我需要得到php7 +和几个PHP扩展。 这是我如何尝试安装它们 $ sudo apt-get install php7.1 php7.1-cli php7.1-curl php7.1-json php7.1-mcrypt php7.1-opcache php7.1-xml php7.1-cgi php7.1-common php7.1-fpm php7.1-mbstring php7.1-mysql php7.1-readline php7.1-xmlrpc 最后一条消息说“ php7.1-fpm start/running, process 24107 ” $ php -v PHP 7.1.10-1+ubuntu14.04.1+deb.sury.org+1 但它没有套接字文件: $ ls /var/run/php php5.6-fpm.pid php5.6-fpm.sock 所以我尝试了几件事情: $ service nginx restart * Restarting nginx nginx $ service php7.1-fpm […]

Nginx的proxy_pass和proxy_set_header导致打开的文件太多

我在nginx中有下面的.conf来平衡服务器a和b: upstream myapp { server a.myapp.com; server b.myapp.com; } server { listen 80; server_name myapp.com; location / { proxy_pass http://myapp; } } 和两个服务器与PHP 7和laravel运行我的应用程序,在同一个nginx内。 通过这个configuration,主机头变成“myapp”,laravel在一些URL系统中使用它来进行资产和链接。 正如文档中所述,我使用了proxy_set_header指令,如下所示: upstream myapp { server a.myapp.com; server b.myapp.com; } server { listen 80; server_name myapp.com; location / { proxy_pass http://myapp; proxy_set_header Host $host; #this causes too many open files } […]

在Nginx上获得PHP的URL段

我有一个PHP脚本,应接受参数作为URL段如下: wwww.site.com/apps/myapp/index.php/param1/param2 目前我有这个工作没有问题(感谢这个问题 ): www.site.com/index.php/param1/param2 然而,我有麻烦得到它的工作时,index.php是在子目录中。 到目前为止,我在nginx.conf中有这个configuration: location / { root /var/www/html; index index.html index.htm index.php; try_files $uri $uri/ /index.php; } location /apps/myapp/ { root /var/www/html/apps/myapp; index index.html index.php; try_files $uri $uri/ /index.php; } location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } 在我的日志中,我仍然得到这个错误: FastCGI sent in stderr: "Primary script […]

502错误的网关错误nginx连接重置由对等

我一直在获取超时导致某些GET请求502错误的网关错误。 我已经尝试将这些行添加到我的nginx站点conf文件中: server { client_max_body_size 500M; client_header_timeout 3000; client_body_timeout 3000; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_read_timeout 3000; fastcgi_send_timeout 3000; fastcgi_connect_timeout 3000; fastcgi_buffers 128 256k; fastcgi_buffer_size 256k; } } 我也试着用以下方法调整缓冲区大小: fastcgi_buffers 256 512k; fastcgi_buffer_size 512k; fastcgi_buffers 64 128k; fastcgi_buffer_size 128k; fastcgi_buffers 32 64k; fastcgi_buffer_size 64k; 我也尝试将PHP-FPM的conf值改为: max_execution_time = 3000 […]

可以将php5-fpmconfiguration为单独的php可执行文件吗?

可以将php5-fpmconfiguration为使用php可执行文件吗? 我想单独编译一些网站在相同的服务器上的PHP,其中一些使用相同的可执行文件。 可以这样configurationphp5-fpm吗?

PHP在脚本之外使用大量内存/时间?

我正在使用在Drupal中build立的网站,一般运行良好。 经过一些优化,需要20-75MB的内存和0.5-2s的大部分请求。 但是偶尔会花费15-20秒,这个过程将会超过1GB +的内存使用量。 我已经试过在PHP执行的开始和结束时(在Drupal的index.php中放置代码)追踪时间和内存使用情况,并且没有显示任何exception(它报告开始和结束之间的差异为1秒,内存一个例子中使用量增加了72MB)。 不知何故,PHP使用了大量的资源,但不在实际的PHP代码中。 这是第一次观察与Apache。 转移到一个新的服务器(使用标准的Ubuntu软件包),使网站更可靠,但它仍然发生。 即使在切换到nginx + php-fpm并完全closuresapache之后,php-fpm进程也显示相同的内存使用模式。 除了标准的PHP模块外,其他的只是memcache,stats和xhprof。 什么可以揭示为什么PHP在脚本本身之外使用如此多的内存?

我得到了一个403禁止与phpmyadmin错误

我正在运行ngnix和php5-fpm,我在Ubuntu 13.04上 server { server_name website.com; access_log /srv/www/website.com/logs/access.log; error_log /srv/www/website.com/logs/error.log; root /srv/www/website.com/public_html; location / { index index.html index.htm index.php; } location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /srv/www/website.com/public_html$fastcgi_script_name; } } 我在/srv/wwww/website.com/public_html/phpmyadmin中有一个到/ usr / share / phpmyadmin的符号链接 不知道发生了什么,我对这一切都很陌生。