为什么有些 PHP 安装有 $_SERVER['SCRIPT_URI'] 而有些没有? [英] Why do some PHP installations have $_SERVER['SCRIPT_URI'] and others not?

查看:28
本文介绍了为什么有些 PHP 安装有 $_SERVER['SCRIPT_URI'] 而有些没有?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行两台 Apache 2 服务器.一个是 PHP5.2,另一个是 PHP5.3.在 5.3 机器上有 $_SERVER['SCRIPT_URI'] 的原因吗?

I run two Apache 2 servers. One has PHP5.2 and the other has PHP5.3. Is there a reason why on the 5.3 machine has $_SERVER['SCRIPT_URI']?

这个变量从何而来?这显然是来自 Apache 环境的东西,它没有记录在 PHP 手册中.然而,它是 ['HTTPS']['SERVER_NAME']['REQUEST_URI'] 组合的便捷快捷方式.

Where does this variable come from? It is clearly something that is coming through from the Apache environment and it is not documented in the PHP manual. It is however a handy shortcut over a combination of ['HTTPS'], ['SERVER_NAME'] and ['REQUEST_URI'].

我尝试过查看配置文件、搜索 SO 和网络.

I have tried looking through configuration files, searching SO and the web.

推荐答案

根据 post onWebHostingTalk 它来自 mod_rewrite:

According to a post on WebHostingTalk it comes from mod_rewrite:

添加

RewriteEngine On

到你的 httpd.conf 文件中的虚拟主机,你想把这个on for 然后重启apache.

To the virtual host in your httpd.conf file that you want to turn this on for and then restart apache.

这篇关于为什么有些 PHP 安装有 $_SERVER['SCRIPT_URI'] 而有些没有?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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