Community Forums

Important Notice:

Two sections of this forum are available only to registered customers. In order to receive access to the Customer Forums and ResellerCentral Forums, you must first register on these forums or login to your existing forum account. If you are an existing HostNine customer, be sure to register using the email address on file for your billing profile.

Go Back   HostNine Community Forums > H9 General Forums > Lounge / Off Topic > Web Development

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 06-17-2007, 12:15 PM
McCarthySites McCarthySites is offline
Web Hosting Guru
 
Join Date: Jun 2007
Posts: 291
Default Use of php5 and DOCUMENT_ROOT

I'm moving scripts over and had been using

$_SERVER['DOCUMENT_ROOT'] as a starting point for things like
require_once().

On Host9, using DOCUMENT_ROOT results in a failure to include because php5 won't go outside of its '/' world which is /www

document root is:

DOCUMENT_ROOT /usr/local/apache/htdocs

doing

require_once ($_SERVER['DOCUMENT_ROOT'] . '/scripts/config.php');

fails with 'no such file or directory'.

Using $_SERVER['SCRIPT_FILENAME'] and pulling the path from that..

Is this a configuration issue with php5? Should document_root be setup to give a path valid for requires/includes ?

Brian
Reply With Quote
  #2  
Old 06-17-2007, 02:17 PM
colt45 colt45 is offline
Junior Guru
 
Join Date: May 2007
Location: Haleiwa, Hawaii
Posts: 213
Default

Viewing the settings using phpinfo in one of my sites shows the setting for 'DOCUMENT_ROOT' being '/home/user/public_html' (where user is my account username) which looks OK to me.

Is the script you're trying to use in the public_html folder?

Last edited by colt45; 06-17-2007 at 02:18 PM. Reason: edit
Reply With Quote
  #3  
Old 06-17-2007, 02:39 PM
McCarthySites McCarthySites is offline
Web Hosting Guru
 
Join Date: Jun 2007
Posts: 291
Default

Quote:
Originally Posted by colt45 View Post
Viewing the settings using phpinfo in one of my sites shows the setting for 'DOCUMENT_ROOT' being '/home/user/public_html' (where user is my account username) which looks OK to me.

Is the script you're trying to use in the public_html folder?
Mine is setup as shown (from phpinfo()) so I'll put in a ticket which should save me lots of editing of scripts...

Brian
Reply With Quote
  #4  
Old 06-19-2007, 07:30 PM
McCarthySites McCarthySites is offline
Web Hosting Guru
 
Join Date: Jun 2007
Posts: 291
Default DOCUMENT_ROOT - result of using ip-based access

After having the site go live (ie dns changes) DOCUMENT_ROOT is now pointing
at the correct path (one that can be used with require() ).

When using ip/~user - document_root is set to /usr/local/apache/htdocs

Which means - I didn't have to update all those scripts... argggg - well, I picked a small site for the first test!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I need a blogs to work on php5 zanass Reseller Hosting 6 06-04-2008 11:34 PM
PHP5 / Zend Liam Web Hosting 5 03-07-2007 08:09 PM


All times are GMT -5. The time now is 12:10 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

Host Nine

Our mission began in 2006. Thousands of awesome clients later, we are now one of the most popular hosters in the world.
Most of this is because of our fantastic support. Join us, you'll be glad you did - that's a given.