Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7632093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:31:53+00:00 2026-05-31T06:31:53+00:00

Sometimes $_SERVER[‘DOCUMENT_ROOT’] returns with a trailing slash. In other environments it does not. Where

  • 0

Sometimes $_SERVER['DOCUMENT_ROOT'] returns with a trailing slash. In other environments it does not. Where can this be specified?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:31:54+00:00Added an answer on May 31, 2026 at 6:31 am

    You can not say in advance if $_SERVER['DOCUMENT_ROOT'] contains a slash at the end or not.

    Normally, if properly configured, it does not contain a trailing slash. On Ubuntu (as well as on other UNIX), a properly written path to a directory does not have the / at the end. On windows for example, apache will even refuse to start if it’s configured with one. On UNIX Apache is not that picky and allows with a trailing slash.

    But there is one exception, if you make your root directory (/) your document root. Because of that case, you can not say in advance whether or not it contains a trailing slash.

    In any case it contains the value of the DocumentRoot directive – with or without trailing slash like it has been written into the httpd configuration file. PHP only takes over the value from apache. To get the real document root, use realpath and/or conditionally add a slash (or remove it) at the end if either in your configuration file or within your PHP code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

sometimes i see an image not being served when the browser look at www.somesite.com/some_image.jpg
After a server restart I sometimes get random CompilationException errors like this: CompilationException: CS0006:
I am not really sure what to do in this situation. I have some
Stored procs in SQL Server sometimes finish with a return code, as opposed to
During development, I usually test ASP.Net applications using the Web Development Server (sometimes called
I'm making AJAX calls to a server that sometimes return unparseable JSON. The server
I have a ruby on rails app running a server and sometimes it needs
Sometimes I get the following from SQL Server 2005 when executing a stored procedure:
Are there any tools for just browsing SQL Server? I ask because sometimes SSMS
I am instantiating a local COM server using CoCreateInstance. Sometimes the application providing the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.