子请求的PHP-CGI [英] Subrequest for PHP-CGI
问题描述
虚拟()
运行PHP作为Apache模块,只有当可以使用。我的共享主机上运行它作为CGI所以这是行不通的。是否有任何其他的方法来做到这一点?
virtual()
can be used only when running PHP as an apache module. My shared hosting runs it as CGI so it doesn't work. Is there any other method to do it?
注:子请求是针对我希望让Apache的服务(性能,HTTP报头缓存等)的静态文件。现在,这是通过使用HTTP重定向(我想摆脱)由PHP脚本发出处理。
Note: the subrequest is for static files that I'd like to let Apache serve (for performance, HTTP-headers caching, etc.). Right now this is handled by using an HTTP redirect (that I want to get rid of) issued by the PHP script.
推荐答案
在最后,我居然发现了一种通过的 X-SENDFILE Apache模块。
发送文件是那么容易,因为执行
In the end I actually found out a way to do this by using the X-Sendfile Apache module. Sending a file is then easy as executing
header("X-Sendfile: $local_file");
exit();
这篇关于子请求的PHP-CGI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!