Closed tmewett closed 8 years ago
I am not sure myself, why all files are referred too relative to root. The $ACCESS_ROOT
variable is still not solving the problem of specifying non-root log-in locations. Use an old version of OneFileCMS to solve the problem of root-relative file referencing, while waiting for a problem fix.
Yeah, I think it's just a case of using the wrong $_SERVER variables. My temporary fix has eliminated all the ugly error messages and is fully-functional so I'll just use that :smile:
(As I seem to always be saying...) Sorry for the delayed response, and thanks for the notes.
I have not experienced the issues above, probably because don't have access to that type of hosting. The only hosted site I manage uses GoDaddy shared hosting, and my development setup is the Uniform Server on an XP box.
So, based on these comments, I'll check out changing how $DOC_ROOT is determined, and confirm if dirname(FILE) should be the solution.
Brilliant, thanks, if you need me to give you any error messages or anything then just ask Also :+1: for this invention, it's proved to be very useful
"By default, $DOC_ROOT uses $_SERVER['DOCUMENT_ROOT'].'/'. This creates problems on virtually-hosted website as this variable points to the completely wrong place, causing it to throw up lots of errors and limit functionality.
I have managed to fix it for myself by replacing all instances of $_SERVER['DOCUMENT_ROOT'] with dirname(FILE) (there aren't very many)
The reason DOCUMENT_ROOT is used for $DOC_ROOT is so that OneFileCMS does not have to be installed in the root folder of a website. In other folders, it needs a way to know where it is relative to the root of the site. That is accomplished by chdir($DOC_ROOT).
On my setups, OneFile can be placed in any folder of a site, and ACCESS_ROOT (if used) can be set to any folder of a site, and everything seems to work. In a virtual setup like what you mention, I'm confused why DOCUMENT_ROOT would point to any other location, regardless of hosting type. However, I've slowly learned that I no longer know everything (like I did in my 20's), and evidently, this is one of those things I don't know.
Anyway, yes, if you could provide a bit more info on the nature of the issue, such as specific error messages, and what directory does DOCUMENT_ROOT point to on your host, that would be helpful. And does the issue present itself when OneFileCMS is installed in the root of your website, or just in other folders, or if in any folder?
I'm glad you've found it useful. I originally started out just offering some minor fixes & improvements to the original developer, but he soon offered me the whole project (not that it's a big project) as he didn't have the time to work on it. I've got time, but I can't seem to get it perfect.. :)
Thanks for your input!
----- Original Message ----- From: Tom Sent: 01/27/13 04:45 AM To: Self-Evident/OneFileCMS Subject: Re: [OneFileCMS] DOCUMENT_ROOT problem with virtual hosting (#21)
Brilliant, thanks, if you need me to give you any error messages or anything then just ask Also :+1: for this invention, it's proved to be very useful
As far as I know, without the modification the script points the root directory to where the Apache web server is found (I think). I remember reading something about how when using virtual hosting one should be careful about using PHP variables to find the root.
EDIT: Oh, it points to /home/user/htdocs
, my mistake
@tmewett Hi man, can you share your file? Thanks
i no longer have it i'm afraid, but you can probably just do a simple substitution with the variables in my original post.
Edit: and that will only work if the file is in the root of your website directory.
no prob. Thx
On Fri, Nov 28, 2014 at 12:20 PM, Tom notifications@github.com wrote:
i no longer have it i'm afraid, but you can probably just do a simple substitution with the variables in my original post.
— Reply to this email directly or view it on GitHub.
If this is still an issue for anyone, with a current version of OneFileCMS, please post a new ticket. Thanks!
By default, $DOC_ROOT uses
$_SERVER['DOCUMENT_ROOT'].'/'
. This creates problems on virtually-hosted website as this variable points to the completely wrong place, causing it to throw up lots of errors and limit functionality.I have managed to fix it for myself by replacing all instances of
$_SERVER['DOCUMENT_ROOT']
withdirname(__FILE__)
(there aren't very many)Are there any reasons why this is not used instead?