Thanks Nathan,

I eventually found this hack. But I was just hoping to change this on the 
server level so we don't have to mess with the code base of 60+ existing sites 
at all. 

Keith, we are talking about migrating existing sites here, not coding new ones.

Someone over on the cPanel forums has responded and I'm looking at an option 
mentioned there. It seems that it should be something set on the server 
globally.

Thanks for responses everyone.

Cheers
Aaron
  ----- Original Message ----- 
  From: Nathan Kennedy 
  To: [email protected] 
  Sent: Monday, March 23, 2009 8:50 AM
  Subject: [phpug] Re: DOCUMENT_ROOT trailing slash


  If you must use $_SERVER['DOCUMENT_ROOT'] and if you have no control over the 
configuration of Apache or PHP, you could use the following hack to ensure that 
it always has the trailing slash:

   

  $_SERVER['DOCUMENT_ROOT'] .= 
(substr($_SERVER['DOCUMENT_ROOT'],-1)=='/')?'':'/';

   

  Thanks,

  Nathan.

  http://control.kennedytechnology.com

   

   

  From: [email protected] [mailto:[email protected]] On Behalf Of 
Aaron Cooper
  Sent: Tuesday, 17 March 2009 4:12 p.m.
  To: [email protected]
  Subject: [phpug] DOCUMENT_ROOT trailing slash

   

  Hi all,

   

  We have a new dedicated server and $_SERVER['DOCUMENT_ROOT'] is returning the 
correct document root with no trailing slash.

   

  On all our old servers, it would return it with a trailing slash. So we have 
alot of sites that require a bit of adjustment for this new box

   

  Is this configurable and would it be managed by php.ini or Apache?

   

  Arguments for and against the trailing slash (or another more portable way of 
obtaining the docroot) is welcome.

   

  Cheers

  Aaron




   


  

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to