Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Shared Hosting Document Root
Old 06-23-2009, 07:15 PM Shared Hosting Document Root
cbeaudin's Avatar
Extreme Talker

Posts: 158
Name: cbeaudin
Location: Proud to be Canadian
Trades: 1
Hi Everyone,

I am trying to move my website from one hosting package to another with hostpapa. My site currently uses $_SERVER['DOCUMENT_ROOT'] for all the paths in PHP.

On my current hosting package this configuration works fine, however it does not work on the hostpapa hosting account. The document_root variable points to '/usr/local/apache/htdocs' and the document root of my website is '/home/<username>/public_html/'.

Is there a way to change the $_SERVER['DOCUMENT_ROOT'] variable for my website only, to point to the correct directory?
__________________
- cbeaudin
cbeaudin is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-23-2009, 07:24 PM Re: Shared Hosting Document Root
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Yes, at the top of your PHP files, just set the variable:

PHP Code:
$_SERVER['DOCUMENT_ROOT'] = '/home/<username>/pubic_html/'
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 06-23-2009, 07:25 PM Re: Shared Hosting Document Root
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Try to call a php_info() on a page, and look if there is something coherent.
I remember having this problem, but it was years ago, and I don't remember how I avoided it.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 06-23-2009, 07:28 PM Re: Shared Hosting Document Root
cbeaudin's Avatar
Extreme Talker

Posts: 158
Name: cbeaudin
Location: Proud to be Canadian
Trades: 1
Thank you for the quick reply and your help.

I was hoping for a solution where i don't have to add this to every file as there are probably about a hundred (if not more) files to this website. Is there a way of changing it across the site from one place? Am i able to do it in an htaccess file for only my website?
__________________
- cbeaudin
cbeaudin is offline
Reply With Quote
View Public Profile
 
Old 06-23-2009, 07:32 PM Re: Shared Hosting Document Root
cbeaudin's Avatar
Extreme Talker

Posts: 158
Name: cbeaudin
Location: Proud to be Canadian
Trades: 1
Quote:
Originally Posted by tripy View Post
Try to call a php_info() on a page, and look if there is something coherent.
I remember having this problem, but it was years ago, and I don't remember how I avoided it.
Not sure what im looking for exactly, the php info shows the "document_root" variable under the "environment" section set to "/usr/local/apache/htdocs" I am gussing this is what you mean.
__________________
- cbeaudin
cbeaudin is offline
Reply With Quote
View Public Profile
 
Old 06-24-2009, 01:40 AM Re: Shared Hosting Document Root
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
If the scripts all access this variable directly, I'm not sure there's much you can do in a quick-fix format. If you're lucky, there's a file included in all other files near the top (say a database connection script?) where you can make this change.

I usually use this code to determine where the driver script is located (for future reference -- not sure if it will help here):

PHP Code:
$file_base dirname(__file__).DIRECTORY_SEPARATOR
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Reply     « Reply to Shared Hosting Document Root
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.48469 seconds with 12 queries