PHP-CGI 的子请求 [英] Subrequest for PHP-CGI

查看:30
本文介绍了PHP-CGI 的子请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

virtual() 只能在 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 标头缓存等).现在这是通过使用 PHP 脚本发出的 HTTP 重定向(我想摆脱)来处理的.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆