document_root trailing slash

anything

Well-Known Member
#1
A small problem when moving a server from apache to litespeed
my apache config defines document root as
DocumentRoot "/path/name/goes/here/"
note the trailing slash.

under apache, php saw:
$_SERVER['DOCUMENT_ROOT'] = '/path/name/goes/here/'

under litespeed, php sees:
$_SERVER['DOCUMENT_ROOT'] = '/path/name/goes/here'

this is causing some old sites of ours to break when the php code does something like
include($_SERVER['DOCUMENT_ROOT'].'filename.php');


normally the trailing slash isnt used in our config, but seems for several vhosts it was, so the programmer wrote the includes as above when developing it.
there were likely thousands of references like that, so my temporary solution was to add a auto_prepend_file script that adds the trailing slash


is it possible that a future lsws release will mirror what apache does?
ie, keep the document root exactly as provided (with, or without trailing slash)
 

Gerry

Active Member
#4
Could it be that this was implemented in 4.1.5?

Since upgrading to 4.1.5, the DOCUMENT_ROOT variable under LiteSpeed ALWAYS has a trailing slash. Our vhost configuration defines all DocumentRoot directives without slash.

This broke quite a few sites, so we're back on 4.1.4 until this gets resolved.
 
Top