Install PW to subdir
Started by Sevarf2, Feb 08 2011 01:24 PM
21 replies to this topic
#6
Posted 09 February 2011 - 09:41 AM
I just checked and see that I've got a couple of PW2 sites running in subdirs with "-" in them, so I don't think that is it.
I'm wondering if you might be running into the same issue as this?
http://processwire.c...topic,46.0.html
Though if that were the case, you'd get the same errors whether at a subdir or root... have you tried installation to root in this hosting environment? If you haven't no need to try, but if you can try creating a test.php file with this in it (from that other thread), and posting theresult, I think it may help to reveal what the problem is:
I'm wondering if you might be running into the same issue as this?
http://processwire.c...topic,46.0.html
Though if that were the case, you'd get the same errors whether at a subdir or root... have you tried installation to root in this hosting environment? If you haven't no need to try, but if you can try creating a test.php file with this in it (from that other thread), and posting theresult, I think it may help to reveal what the problem is:
<?php $rootPath = dirname(__FILE__); echo "RootPath:".$rootPath."</br>"; if(DIRECTORY_SEPARATOR != '/') $rootPath = str_replace(DIRECTORY_SEPARATOR, '/', $rootPath); echo "NewRootPath:".$rootPath."</br>"; echo "HTTP_HOST:".$_SERVER['HTTP_HOST']."<br/>"; echo "DOCUMENT_ROOT:".$_SERVER['DOCUMENT_ROOT']."<br/>"; $rootURL = isset($_SERVER['HTTP_HOST']) ? substr($rootPath, strlen(rtrim($_SERVER['DOCUMENT_ROOT'], '/'))) . '/' : '/'; echo "RootURL:".$rootURL; ?>
#7
Posted 09 February 2011 - 09:45 AM
this is the result:
rootURL is cutted
in the same server i have other PW sites and all work good.
RootPath:/home/hdps/domains/disinibiti.com/public_html/racconti-erotici NewRootPath:/home/hdps/domains/disinibiti.com/public_html/racconti-erotici HTTP_HOST:www.disinibiti.com DOCUMENT_ROOT:/var/www/hdps/domains/disinibiti.com/public_html RootURL:cconti-erotici/
rootURL is cutted
in the same server i have other PW sites and all work good.
#8
Posted 09 February 2011 - 09:54 AM
To get it working temporarily, you can set the value of $rootURL in /index.php manually to the correct value: "/racconti-erotici/". But I can see that the problem is that rootPath and DOCUMENT_ROOT are not consistent with each other. They should be referring to the same path, and instead they are referring to different paths. There must be some aliasing going in with the paths at the server side. We've seen this happen in another case, so I think it's something that ProcessWire needs to account for rather than an actual problem at the server. Now to figure out a solution...
#10
Posted 12 April 2011 - 03:17 PM
I'm having a similar "install" issue. On a fresh whm/cpanel account with a new download from github of PW I get:
"Unable to complete this request due to an error"
Again, on a new account created on a VPS from Servint; running WHM/Cpanel/apache who's path would normally be IP/~account/whatever.x The VPS is new for dev; for a domain that already exists; poking path directly is only option (IP/howeverIhavetotypetoseeOnweb)
Using test.php
RootPath:/home/theameri/public_html/process
NewRootPath:/home/theameri/public_html/process
HTTP_HOST:64.6x.xx.xxx
DOCUMENT_ROOT:/usr/local/apache/htdocs
RootURL:ml/process/
Adding ~ to line 110 of the .htaccess: RewriteCond %{REQUEST_URI} "^[-_.a-zA-Z0-9/~]*$" doesn't help.
Making line 46 of index.php $rootURL = '/~theameri/' or $rootURL = '/~theameri/process/' doesn't do it either.
I can run the installer directly (install.php) and everything checks ok; but then the site itself is missing all the css and images/and there is nothing available in the admin page ...
I've installed pw successfully on another server; where can I check to make sure mod_rewrite is on? I can recompile apache/php - have twice, but am easily missing something...
Thanks
"Unable to complete this request due to an error"
Again, on a new account created on a VPS from Servint; running WHM/Cpanel/apache who's path would normally be IP/~account/whatever.x The VPS is new for dev; for a domain that already exists; poking path directly is only option (IP/howeverIhavetotypetoseeOnweb)
Using test.php
RootPath:/home/theameri/public_html/process
NewRootPath:/home/theameri/public_html/process
HTTP_HOST:64.6x.xx.xxx
DOCUMENT_ROOT:/usr/local/apache/htdocs
RootURL:ml/process/
Adding ~ to line 110 of the .htaccess: RewriteCond %{REQUEST_URI} "^[-_.a-zA-Z0-9/~]*$" doesn't help.
Making line 46 of index.php $rootURL = '/~theameri/' or $rootURL = '/~theameri/process/' doesn't do it either.
I can run the installer directly (install.php) and everything checks ok; but then the site itself is missing all the css and images/and there is nothing available in the admin page ...
I've installed pw successfully on another server; where can I check to make sure mod_rewrite is on? I can recompile apache/php - have twice, but am easily missing something...
Thanks
#11
Posted 12 April 2011 - 03:27 PM
Line 46 won't work because that line only gets executed if you are booting PW from elsewhere. You'll need to do it after line 46, like like 48. Try this on line 48:
Let me know if that does or doesn't fix it. Once we find a way to fix it, I should be able to find a way to fix it in PW so that other people on a similar server setup don't run into the same issue. Though this appears to be a little bit different issue than we've seen before, but it appears to be a PW issue not a server one.
As for mod_rewrite, the installer checks to make sure it's installed. If it didn't give you an error about mod_rewrite not being installed, then you should be good.
$rootURL = '/~theameri/process/';
Let me know if that does or doesn't fix it. Once we find a way to fix it, I should be able to find a way to fix it in PW so that other people on a similar server setup don't run into the same issue. Though this appears to be a little bit different issue than we've seen before, but it appears to be a PW issue not a server one.
As for mod_rewrite, the installer checks to make sure it's installed. If it didn't give you an error about mod_rewrite not being installed, then you should be good.
#13
Posted 12 April 2011 - 03:44 PM
Well, it fixed the main page, but the admin stuff isn't there
Just a 404 @ /~theameri/process/processwire/ -- as are all the other pages in the main template (about/site-map/templates)...Do I manually correct them in lines 50-54?
Weird that only the main page is working but sure that means something...
Weird that only the main page is working but sure that means something...
#14
Posted 12 April 2011 - 04:48 PM
Jeff,
Open the .htaccess file in a text editor. Around like 70, you'll see this:
Uncomment one of the lines above, and set it to your RewriteBase. Try:
or
Not sure that'll solve it, but it's worth a try.
Open the .htaccess file in a text editor. Around like 70, you'll see this:
# ----------------------------------------------------------------------------------------------- # Optional: Set a rewrite base if rewrites aern't working properly on your server. # ----------------------------------------------------------------------------------------------- # RewriteBase / # RewriteBase /pw
Uncomment one of the lines above, and set it to your RewriteBase. Try:
RewriteBase /process/
or
RewriteBase /~theameri/process/
Not sure that'll solve it, but it's worth a try.
#15
Posted 13 April 2011 - 10:14 AM
Jeff,
One other thing to try:
Open your .htaccess file and paste a bunch of random characters at the top, like "alkjzb0983t093ozjvozubzb"
Load your site. You should get a "500" Server Error. If not, then Apache isn't reading your htaccess at all. To fix that you may need to edit your httpd.conf file (/etc/httpd.conf, /usr/local/apache/conf/httpd.conf, or equivalent). To do that, edit the file and locate your <VirtualHost> directive for the domain where you've installed PW. Add a line within that directive:
You might also just want to do that for the whole server, as it's kind of expected in a hosting environment to be able to use .htaccess files and other things. So you could locate your <Directory "/">:
I'm not an expert on Apache configs. Just found this has worked for me in the few situations where I've run across servers that weren't reading htaccess files.
One other thing to try:
Open your .htaccess file and paste a bunch of random characters at the top, like "alkjzb0983t093ozjvozubzb"
Load your site. You should get a "500" Server Error. If not, then Apache isn't reading your htaccess at all. To fix that you may need to edit your httpd.conf file (/etc/httpd.conf, /usr/local/apache/conf/httpd.conf, or equivalent). To do that, edit the file and locate your <VirtualHost> directive for the domain where you've installed PW. Add a line within that directive:
AllowOverride All
You might also just want to do that for the whole server, as it's kind of expected in a hosting environment to be able to use .htaccess files and other things. So you could locate your <Directory "/">:
<Directory "/"> Options All AllowOverride All </Directory>
I'm not an expert on Apache configs. Just found this has worked for me in the few situations where I've run across servers that weren't reading htaccess files.
#16
Posted 13 April 2011 - 11:28 AM
I did get the 500 error; but then adding either RewriteBase options I still get:
The requested URL /~theameri/process/about/ was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
(or The requested URL /~theameri/process/processwire was not found on this server.)
:/
The requested URL /~theameri/process/about/ was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
(or The requested URL /~theameri/process/processwire was not found on this server.)
:/
#18
Posted 13 April 2011 - 06:40 PM
It sure is acting that way, but it's on...
So what about DNS stuff; does PW care about any of that? Wouldn't it work from the IP regardless of the DNS stuff? It certainly does the install and the main page...maybe I'll try it on the root and see what happens...will let you know.
So what about DNS stuff; does PW care about any of that? Wouldn't it work from the IP regardless of the DNS stuff? It certainly does the install and the main page...maybe I'll try it on the root and see what happens...will let you know.
#19
Posted 13 April 2011 - 09:29 PM
Jeff, dns stuff should not matter... PW doesn't care. But I am curious to see if it works at root ( without the ~theameri part). I got your email with the phpinfo, and it looks perfect, I can't find anything wrong there. This is quite a mystery. If you want to set me up with a shell or FTP access, I can go in and solve it hopefully.
Malheur is great stuff btw.. Finally got around to trying it the other day, and think I'm going to have to enjoy another once we figure this out.
Malheur is great stuff btw.. Finally got around to trying it the other day, and think I'm going to have to enjoy another once we figure this out.
#20
Posted 14 April 2011 - 08:43 AM
I fixed this problem on Jeff's server and wanted to reply here to follow up on what the issue was.
The problem involved the URL starting with a "~", like this: /~theameri/process/
Apparently Apache needs the RewriteBase directive set in your .htaccess file if you are using this style of "~" URL off of your domain. And it needs to be set with the part that includes the "~" (something that we didn't cover earlier in the thread). So on Jeff's server, with PW installed in the /process/ directory off of his web root, I set the RewriteBase directive in the .htaccess file like this:
If it weren't installed in the /process/ subdirectory (and installed in his web root), it would be this:
There were two other problems in the PW code that also prevented the "~" URLs from working:
1. PW's htaccess doesn't send any URLs with invalid characters to ProcessWire. I had to add the optional "~" at the beginning of the request URI in the .htaccess so that it would still send that to PW. This has been committed to the source.
2. PW's method of determining the root URL was also not compatible with "~" URLs. I changed it to determine it from $_SERVER['SCRIPT_NAME'] rather than $_SERVER['DOCUMENT_ROOT'], and this has also been committed (not sure why I didn't do this before!).
So that's what the issues were, and hopefully we've got this figured out so that nobody else runs into it in the future.
Jeff--thanks for your patience in troubleshooting this and helping me to resolve it.
The problem involved the URL starting with a "~", like this: /~theameri/process/
Apparently Apache needs the RewriteBase directive set in your .htaccess file if you are using this style of "~" URL off of your domain. And it needs to be set with the part that includes the "~" (something that we didn't cover earlier in the thread). So on Jeff's server, with PW installed in the /process/ directory off of his web root, I set the RewriteBase directive in the .htaccess file like this:
RewriteBase /~theameri/process/
If it weren't installed in the /process/ subdirectory (and installed in his web root), it would be this:
RewriteBase ~/theameri/
There were two other problems in the PW code that also prevented the "~" URLs from working:
1. PW's htaccess doesn't send any URLs with invalid characters to ProcessWire. I had to add the optional "~" at the beginning of the request URI in the .htaccess so that it would still send that to PW. This has been committed to the source.
2. PW's method of determining the root URL was also not compatible with "~" URLs. I changed it to determine it from $_SERVER['SCRIPT_NAME'] rather than $_SERVER['DOCUMENT_ROOT'], and this has also been committed (not sure why I didn't do this before!).
So that's what the issues were, and hopefully we've got this figured out so that nobody else runs into it in the future.
Jeff--thanks for your patience in troubleshooting this and helping me to resolve it.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













