Hi all

I build websites and have been forced to use United Hosting to host the current project but when I have come to upload the admin site (to a subdomain), the scripts have failed.

After some headscratching investigation I discovered the PHP Document Root for the subdomain is set to the same as the top level domain. I submitted a support ticket the the response was:

"This is how it works on Ensim chrooted environment. You should need to give the absolute path in the script rather than using the variable SERVER['DOCUMENT_ROOT']."

Now, problem here is all my scripts (and my WYSIWYG editor) use Document Root.

AAAARRRRGGGGGHHHHHHHHH!!!!!!!!!!

does anyone know of a quick solution to my problem (other than move hosting companies!)

Regards
kbc

    Disclaimer: I've not tried or tested this, and I'm not sure it's the right advice . . . So, I'd recommend researching it first, but in the php.ini file is this entry, which might be what you're looking for.

    ; The root of the PHP pages, used only if nonempty.
    ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
    ; if you are running php as a CGI under any web server (other than IIS)
    ; see documentation for security issues. The alternate is to use the
    ; cgi.force_redirect configuration below
    doc_root =

      There is a function
      [man]chroot/man
      ... but not available for Windows

        Thanks for your suggestions. I tried this:

        	chroot("/var/www/html/admin");
        
        echo $_SERVER['DOCUMENT_ROOT'];
        exit;
        

        But the doc root still comes out as /var/www/html

        Any other things I can try?

          kbc1 wrote:

          Any other things I can try?

          Yup - something you should have done a long time ago; find a competent host. If your hosting provider can't provide you with the environment that you need, then you should find a better provider - there are too many available these days to justify being stuck with a poor one.

          The only way you can change $_SERVER['DOCUMENT_ROOT'] is by altering the webserver config. You could accomplish this by using a <VirtualHost> directive and specifying DocumentRoot, but this would require that you be able to use your own httpd.conf file as well. If this is possible, then you're in luck. Otherwise, ditch the host.

            Write a Reply...