Checking out the project and the functionalities , I did recognize that file_get_contents
for internal files doesn't work at all. It always give me the same error :
检查了项目和功能之后,我确实发现内部文件的file_get_contents根本不起作用。它总是给我同样的错误:
file_get_contents 504 gateway timeout
file_get_contents 504网关超时
Can you help me to find out how to fix it?
你能帮我找到修理的方法吗?
1 个解决方案
#1
1
For Nginx server
Nginx服务器
Check that you are not running into worker depletion on the PHP side of things, I had face this issue too on my lab server setup which was configured to save RAM. Basically I forgot that you are using a single worker to process the main page been displayed to the end-user, then the get_file_contents() function is basically generating a separate HTTP request to the same web server, effectively requiring 2 workers for a single page load. As the first page was using the last worker there was none available for the get_file_contents function, therefore Nginx eventually replied with a 504 on the first page because there was no reply on the reverse proxy request.
检查您是否在PHP方面运行了worker耗尽,我在实验室服务器设置中也遇到了这个问题,它被配置为保存RAM。基本上,我忘记了您正在使用一个worker来处理向最终用户显示的主页面,然后get_file_contents()函数基本上是为同一个web服务器生成一个单独的HTTP请求,这实际上需要两个worker来加载一个页面。由于第一个页面使用的是最后一个worker,所以get_file_contents函数没有可用的,因此Nginx最终在第一个页面上回复了504,因为在反向代理请求上没有应答。
#1
1
For Nginx server
Nginx服务器
Check that you are not running into worker depletion on the PHP side of things, I had face this issue too on my lab server setup which was configured to save RAM. Basically I forgot that you are using a single worker to process the main page been displayed to the end-user, then the get_file_contents() function is basically generating a separate HTTP request to the same web server, effectively requiring 2 workers for a single page load. As the first page was using the last worker there was none available for the get_file_contents function, therefore Nginx eventually replied with a 504 on the first page because there was no reply on the reverse proxy request.
检查您是否在PHP方面运行了worker耗尽,我在实验室服务器设置中也遇到了这个问题,它被配置为保存RAM。基本上,我忘记了您正在使用一个worker来处理向最终用户显示的主页面,然后get_file_contents()函数基本上是为同一个web服务器生成一个单独的HTTP请求,这实际上需要两个worker来加载一个页面。由于第一个页面使用的是最后一个worker,所以get_file_contents函数没有可用的,因此Nginx最终在第一个页面上回复了504,因为在反向代理请求上没有应答。