| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read | ![]() |
|
||||||
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi all, I use $_SERVER["DOCUMENT_ROOT"]in a lot of my scripts to locate files from the root (public_html) of my websites. I have installed a website here and now $_SERVER["DOCUMENT_ROOT"] points to the document root of Apache.
I have asked support if this can be changed but they say it can't. I am moving from an Apache and linux setup where my scripts worked ok, so....I am just wondering why this is different? It's no big deal, it is just much easier to use $_SERVER["DOCUMENT_ROOT"] and copy and paste it into different php pages. php.ini ??? thx Jon |
|
|||
|
Well, the domain has just resolved on my VPS and the $_SERVER["DOCUMENT_ROOT"] works! So it must be pointing to public_html.
I have been testing the site using the ip/~username which points to Apache docs but the domain name doesn't. I am sure there is a good reason why this is so, but who cares, as long as it is pointing to public_html when the domains resolve, I'm am happy |
|
|||
|
Thats what confused me.
I am quite sure that when you use the domain name then it will consider your public_html as document root coz apache configuration has got your public_html as the document root for your domain name but the IP address points to /usr/local/apache/htdocs so when you access your website with IP/~username/ then it shows the document root of the IP address. You can change the document root of your IP address from /usr/local/apache/conf/httpd.conf
__________________
Web Hosting UK - ASP MSSQL Hosting - cPanel Linux Hosting AIM : webredback || msn : andrew @ webhosting.uk.com Toll Free : 0808 262 0855 |
|
|||
|
Quote:
Thanks, now I understand. I have just edited my php.ini using SSH which may seen insignificant to most, but a giant leap for me. I take it that I would edit or view the httpd.conf the same way using vi ? (if I wanted to edit it) |
|
|||
|
Yeah. You can do it through vi but I am permanent customer of pico editor.
using vi you will need to type following to locate the first virtualhost entry of your IP which is considered as the default one :- /87.117.236.*:80 If you replace /usr/local/apache/htdocs with your /home/username/public_html then default root of the IP address will change. ESC + ! + w + q ENTER
__________________
Web Hosting UK - ASP MSSQL Hosting - cPanel Linux Hosting AIM : webredback || msn : andrew @ webhosting.uk.com Toll Free : 0808 262 0855 |
|
|||
|
I've just worked through the same issue. I am swapping a website over to this hosting and I wanted to test it before changing the domain name to point to it's new home. The way I got around it was to add this to the root .htaccess file:
Code:
Options +FollowSymlinks RewriteEngine on rewriterule (.*)\.php http://ip/~username/wrapper.phtml?page=$1.php [r=301,nc,l] Code:
$_SERVER['DOCUMENT_ROOT'] = '/home/username/public_html'; include $_GET['page']; |
![]() |
| Thread Tools | |
| Display Modes | |
|
|