简体   繁体   English

PHP session_write_close()在NGINX中不起作用

[英]PHP session_write_close() does not work in NGINX

I'm having trouble running session_write_close() on Nginx, it has no effect. 我在Nginx上运行session_write_close()时遇到问题,它没有效果。

When I access resources that take a long time to complete, the other pages of the application are blocked, waiting for the first page to finish. 当我访问需要很长时间才能完成的资源时,该应用程序的其他页面将被阻止,等待第一页完成。

I migrated my application from Apache to Nginx, in Apache it was working normally. 我将我的应用程序从Apache迁移到Nginx,在Apache中它可以正常工作。

No information appears in the Nginx or Apache log. Nginx或Apache日志中没有信息。 Does anyone know why this occurs? 有谁知道为什么会这样?

Best regards. 最好的祝福。

I also experienced the same with php 7 and Nginx. 我在php 7和Nginx上也经历了同样的事情。 You can change your cache memory, use memchached or redis. 您可以更改缓存,使用memchached或redis。

Assuming nginx is running by default under the username nginx, then I would check /var/lib/php/session foder and see if it has the proper ownership. 假设默认情况下nginx在用户名nginx下运行,那么我将检查/ var / lib / php / session foder,看看它是否具有适当的所有权。 If you switched from apache, then that folder has either nobody or www-data ownership (user/group). 如果从apache切换,则该文件夹将没有任何人或www数据所有权(用户/组)。 So do a ls -lsa /var/lib/php/session , see who owns the folder and then do a chown nginx:nginx /var/lib/php/session -R . 因此,执行ls -lsa /var/lib/php/session ,查看谁拥有该文件夹,然后执行chown nginx:nginx /var/lib/php/session -R Then try again and see if it works or not. 然后重试,看看是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM