Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do some PHP installations have $_SERVER['SCRIPT_URI'] and others not?

Tags:

php

apache2

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']?

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'].

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

like image 583
Treffynnon Avatar asked Dec 12 '22 07:12

Treffynnon


1 Answers

According to a post on WebHostingTalk it comes from mod_rewrite:

Add

RewriteEngine On

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

like image 57
Paté Avatar answered Apr 26 '23 10:04

Paté