Jump to content

Install PW to subdir


Frank Vèssia
 Share

Recommended Posts

You can install it at any directory level and it should work just fine. ProcessWire doesn't care if it's in the root, a subdirectory, tertiary directory, etc. You don't need to configure anything for this, as it will pick it up automatically.

Link to comment
Share on other sites

That's odd -- does it work in a subdir without the "-" in it? I can't think of any reason why that would be the case, but just wanted to check. Also, what is the context of the hosting environment?

Link to comment
Share on other sites

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.com/talk/index.php/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;
  ?>
Link to comment
Share on other sites

this is the result:

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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

  • 2 months later...

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

Link to comment
Share on other sites

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:

$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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

Jeff,

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.

Link to comment
Share on other sites

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:

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.

Link to comment
Share on other sites

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.)

:/

Link to comment
Share on other sites

Jeff, do you have a phpinfo() page? If not, upload a test.php to your server with this in it:

<?php phpinfo();

Look at the result. See if it says anything about mod_rewrite. It really sounds like mod_rewrite is inactive or not working.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. :)

Link to comment
Share on other sites

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:

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. 

Link to comment
Share on other sites

Having used Processwire 1.0 - aka Dictator - for some 7 years now without a single hiccough or security issue - and no patches! - I know that PW is worth it - so thanks for caring enough TO resolve it!

FWIW, why would you ever have "~" in your path? This is a dev server that I don't care to ever have as an actual domain - and the "IP/~account" is Apache's way of accessing account directories created in the home folder...so I'll probably do it again - glad it's an easy, top down "fix".

Malheur on my tab next time I'm there!

Link to comment
Share on other sites

Thanks Jeff -- glad that Dictator has been working well for you. The problem I'm having with some other Dictator sites is that the clients don't seem motivated to upgrade. Going and working on 7+ year old code so isn't fun, even if it's still functional. :) But I sure wish I'd put Dictator out there as open source back in 2003. Get in touch next time you are passing through the city of Decatur. I'll get the second round. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...