1

Topic: Having trouble with setup

I'm trying to get ochiba working on my dreamhost account. I was able to install HTML_Template_IT and sqlite and set up the database, but when I try to access /admin or /index.php/admin I get an untitled page with the text "No input file specified."

I'd like to provide more information but I really don't know what's relevant, or the cause of this at all. ..;;

2

Re: Having trouble with setup

Hmm, that's a strange one. This query indicates it's an odd problem that seems to occur with a variety of different PHP software depending on the hosting setup, but I can't find a common solution.

Can you tell if mod_rewrite is enabled for your directory (you might want to ask your hoster if not)? It's required, the way ochiba is currently written.

If so, can you put a echo $_SERVER["PATH_INFO"] somewhere near the top of index.php and tell me what it reports when you try to access /admin?

Is this on a Windows based server or Unix one? If on Unix, is it running PHP as a CGI?

Does this discussion seem like something that might be applicable? Or this one?

3

Re: Having trouble with setup

I'm pretty sure mod_rewrite is enabled as I'm successfully running two wakaba boards in another directory, and didn't have to do anything special to configure it there. To make sure, I turned on link protection for the directory through the web panel, then copied ochiba's .htaccess over the one that was installed. No change.

I added the line to index.php, but accessing /admin and /index.php/admin through HTTP still return "No input file specified." Meanwhile, /, /index.php and /index.php?admin return another strange error:

gallery.mydomain.org
Making HTTP connection to gallery.mydomain.org
Sending HTTP request.
HTTP request sent; waiting for response.
HTTP/1.1 302
Data transfer complete
HTTP/1.1 302
Looking up gallery.mydomain.org
gallery.mydomain.org
... (repeat above)
Alert!: Redirection limit of 10 URL's reached.

This is a UNIX server running PHP as CGI. Dreamhost warns me that disabling running PHP as CGI is insecure and otherwise problematic, so I don't want to do that unless you think it's the only solution.

I tried the solution for the first discussion (renaming index.php to ochiba.php and adjusting the .htaccess appropriately) but again there was no change. The second discussion seems to deal mostly with getting custom 404 pages. The only comment that looked relevant reports having success with the .htaccess line "RewriteRule ^(.*)$ wiki.php?title=$1 [L,QSA]", which looks the same as ochiba's default, "RewriteRule ^(.*)$ index.php/$1 [L,QSA]".

4

Re: Having trouble with setup

Clarification: accessing /admin and /index.php/admin through HTTP still return "No input file specified." and nothing else.

Maybe I should register so I can edit my posts.

5

Re: Having trouble with setup

Hmm, some things to try (these are just off the top of my head, or from notes mentioned in the discussions linked above)

* cgi.fix_pathinfo=1 in your php.ini

* fiddle with the path-discovery variables at the end of conf.php. In particular, it seems like PHP run in cgi mode will not set certain $_SERVER variables relating to path to the correct path to the php file - instead, it is set to the php.cig binary, apparently. See the note by dasil003 at the end of the dreamhost knowledge base page. Try putting "echo"s in there with various variables and load /conf.php to see that they are being set correctly ($fileroot, $docroot, ROOT, __FILE__, etc).

* Try running PHP as a module rather than CGI, if only to see if this clears things up.

Personally, I think Dreamhost's "warnings" are a little overstated. You don't run any additional risk to yourself by running PHP as a module, and if anything it can make your stuff a little more secure if done properly. However, you do increase the risk to others on a shared hosting server, which is Dreamhost's perspective.

6

Re: Having trouble with setup

I don't have access to the systemwide php.ini. Is there somewhere I can create one locally to set that option?

The directories all look right except for ROOT, which comes out blank. I commented out the define and replaced it with "define("ROOT",$docroot);". This turned ABSOLUTE_ROOT into "http://gallery.mydomain.com/home/.taily … domain.com", which caused index.php to redirect me there and spat out 'No input file specified' again. I removed the reference to ROOT in the ABSOLUTE_ROOT define and it went back to the HTTP 302 problem.

If I turn running PHP as CGI off, I get this error:
"Warning: dl() has been disabled for security reasons in /home/.taily/mydomain/gallery.mydomain.org/conf.php on line 12"

It seems as if I'm having two separate problems here; mod_rewrite won't work, and index.php is compelled to redirect me somewhere else instead of loading properly. I'd rather work on the index.php problem...

7

Re: Having trouble with setup

7hs wrote:

I don't have access to the systemwide php.ini. Is there somewhere I can create one locally to set that option?

Hmm, I was under the impression from the Dreamhost kbase article that you had a separate php.ini somewhere. Perhaps I misunderstood- see mdpaciga's post on that page.

As for the directory variables, you might want to try hardcoding stuff for you installation since I think this may be the area where the problem lies. For example, if you have files in /home/7hs/webroot/ochiba/ that map to http://gallery.mydomain.com/, then:

define("ROOT","");
define("ABSOLUTE_ROOT","http://gallery.mydomain.com/");

In the case of ochiba being installed at the top level of a vhost, ROOT being blank is correct. I think this was already occurring in the self-discovery/default, but you might give it a try. Also, try adding ini_set("include_path", ".:/path/to/ochiba/directory:/path/to/pear" ) at the top of conf.php to see if that's a trip up.

BTW, does __FILE__ work? If it doesn't then this is a bigger problem :|

Finally, what happens if you remove the .htaccess file and access /index.php?

7hs wrote:

If I turn running PHP as CGI off, I get this error:
"Warning: dl() has been disabled for security reasons in /home/.taily/mydomain/gallery.mydomain.org/conf.php on line 12"

Ah, so that is how you got the sqlite module to work on Dreamhost.

8

Re: Having trouble with setup

I think maybe mdpaciga is talking about running your own local install of PHP, which seems a bit heavy for a solution...

None of the suggestions changed anything, index.php still returns an infinite loop of HTTP 302's, except that with .htaccess gone the page returned wasn't text/html and lynx didn't like it.

__FILE__ is "/home/.taily/mydomain/gallery.mydomain.com/conf.php" which looks right to me.

9

Re: Having trouble with setup

Drat.

OK, one last idea: in .htaccess, change the rewrite rule lines near the end from:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

to

RewriteCond %{SCRIPT_NAME} !-f
RewriteCond %{SCRIPT_NAME} !-d

or

RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} !-d

I'll try to set up a php-as-cgi system to tinker with this more directly if that doesnt' work out.

10

Re: Having trouble with setup

%{SCRIPT_NAME} causes an internal server error and %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} does the infinite redirect loop thing again.

I can set up a subdomain & shell for you to play around with on my server if you want. Renders my URL obfuscation moot, but that's mostly for the benefit of any random passersby, not you. :)

11

Re: Having trouble with setup

7hs wrote:

I can set up a subdomain & shell for you to play around with on my server if you want.

Hmm, that would certainly expedite things. I've been wondering if I could even re-create Dreamhost's setup to the point where it becomes meaningful.

If the offer still stands, drop me an email (ochiba at x-maru.org) and let me know how you'd like to handle things.

12

Re: Having trouble with setup

WOW, what madness.

Thanks for the access. I think I kind of got it working. The Dreamhost build of PHP is whacked- apparently, it chokes on trying to find "index.php/blah" as per the RewriteRule- it never finds it and ochiba never "runs". I don't know if the "cgi.fix_pathinfo" param would fix this, but you don't have access to php.ini to try it out.

Anyway, two seemingly minor modifications makes it work:

.htaccess
This sends PHP the "path_info" as part of the GET string, instead of a real PATH_INFO. Thank god for the Apache folks.

11c11
< RewriteRule ^(.*)$ index.php/$1 [L,QSA]
---
> RewriteRule ^(.*)$ /index.php?$1/ [L,QSA]

index.php
This converts the path_info kludge from the .htaccess into what ochiba expects.

29,30c29
< 
< $path_parts = explode("/",$_SERVER["PATH_INFO"]);
---
> $path_parts = explode("/","/" . $_SERVER["argv"][0]);

Another thing I noticed is that the caching doesn't work for some strange reason. You have to turn it off, or else you'll get stale cache reads.

Also, there are issues with the setuid behavior when it creates directories; I had to manually chmod 755 on thumbs and thumbs/00/. images/ and images/00/ don't need it in the default because of the way it works. This can be addressed by adding a umask call prior to the mkdir()s in post.php and process_image.php. Otherwise, you'll have errors when it gets to thumbs/01/.

Finally, /stats doesn't work because it appears Dreamhost has set that up as a special URL so ochiba never even gets that request. Madness, I tell you!

I left it set up at the site you provided- let me know if you notice any oddities I missed.

13

Re: Having trouble with setup

Thanks, those did the trick!

One glitch: The "Search" link doesn't seem to work, instead it redirects me to a page saying "No posts." Is there a minimal number of images in the database required to perform a search?

14

Re: Having trouble with setup

Oops, I thought I had fixed that. Here's a new update for index.php, to get rid of the trailing slash.

29,30c29,30
< 
< $path_parts = explode("/",$_SERVER["PATH_INFO"]);
---
> $path_parts = explode("/","/" . $_SERVER["argv"][0]);
> array_pop($path_parts);

/search is working now.

15

Re: Having trouble with setup

Hello.

I was having the same problem with my dreamhost account, however those fixes didn't work for me.

Here's what my .htaccess currently looks like:

DirectoryIndex index.php
RewriteEngine On
# Uncommment the next three lines if you want to prevent others from direct
# linking your images. Make sure to enter your site's url, or your own
# site won't be able to access them either!
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://elitepeeps.net/.*$ [NC]
RewriteRule ^.*\.(gif|jpg|png)$ img/bad.gif [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]

I dont want to disappoint my friends, so I hope I can find a solution to this problem with you guys.

Thank you very much.

--Hontaiyo

16

Re: Having trouble with setup

Sorry, I forgot to also add the index.php (the section I edited):

//----- Get $path. Should be a letter, if a category filter is requested
//        or a number, if a specific image is requested. Then there are
//        special action keywords (post,comment,delete)

$path_parts = explode("/","/" . $_SERVER["argv"][0]);
array_pop($path_parts);
$page_num = is_numeric($_GET["p"]) && $_GET["p"]>0 ? $_GET["p"] : 1;
switch ($path) {

17

Re: Having trouble with setup

Here is the error report Apache the host gives me:

[Mon Sep  5 17:33:41 2005] [error] [client 65.78.105.155] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.

18

Re: Having trouble with setup

Hmm. I don't know dreamhost well enough to hazard a guess why the hacks to get 7hs up and running are not working for you; maybe they have different configs across different servers?

I take it the default install didn't work, and that's why you tried to hacks mentioned above?

Do you get any output if you put the following into index.php (after the $path_parts = explode line):

var_dump($path_parts);exit;

19

Re: Having trouble with setup

Sorry for the long wait, I get some strange feedback with that line:

array(2) { [0]=>  string(0) "" [1]=>  string(0) "" }

what does it mean?

20

Re: Having trouble with setup

when I input the original script with your line:

$path_parts = explode("/",$_SERVER["PATH_INFO"]);
var_dump($path_parts);exit;

I get this as a result instead:

array(3) { [0]=>  string(0) "" [1]=>  string(6) "ochiba" [2]=>  string(9) "index.php" }

21

Re: Having trouble with setup

Hontaiyo wrote:

array(3) { [0]=>  string(0) "" [1]=>  string(6) "ochiba" [2]=>  string(9) "index.php" }

Oh, I think I see what's going on. The line in .htaccess should be:

RewriteRule ^(.*)$ index.php/$1 [L,QSA]

Notice that there is no slash before "index.php". In 7hs's case, my notes were specific to his case, in which ochiba was installed at the top level of the domain, but in your case, it is within a subdirectory, so the slash is messing it up.

22

Re: Having trouble with setup

When I did that I got a 500 error.

I decided to make a subdomain for the file in my dreamhost account. If it's not too much trouble i'd like to give you access for you to get a hands on look at the files.

Here's the error the server gave me:

[Sun Sep 11 16:29:54 2005] [error] [client xxx.xxx.xxx.xxx] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.

I'm really sorry for all the trouble.

23

Re: Having trouble with setup

Hontaiyo wrote:

//----- Get $path. Should be a letter, if a category filter is requested
//        or a number, if a specific image is requested. Then there are
//        special action keywords (post,comment,delete)

$path_parts = explode("/","/" . $_SERVER["argv"][0]);
array_pop($path_parts);
$page_num = is_numeric($_GET["p"]) && $_GET["p"]>0 ? $_GET["p"] : 1;
switch ($path) {

I think I found the problem. There needs to be a "$path = $path_parts[1]" in there, after the array_pop(). Dunno how that got lost.

In your case, I've made the following edits from the distributed (0.9.3) files:

.htaccess

< RewriteRule ^(.*)$ index.php/$1 [L,QSA]
---
> RewriteRule ^(.*)$ index.php?$1/ [L,QSA]

index.php

< $path_parts = explode("/",$_SERVER["PATH_INFO"]);
---
> $path_parts = explode("/", "/" . $_SERVER["argv"][0]);
> array_pop($path_parts);

I believe it is working now, as apparently you have discovered ;)

Re: Having trouble with setup

lol, yes it is, and I thank you for it. I'm sorry for interrupting you. I didn't know you we're already at work. At first I thought I did something right. lol.

The only thing that doesn't work right now is the stats page, but I guess I can disable that since it's not necessary.

25

Re: Having trouble with setup

Yeah, the stats page I don't think I can do anything about. Dreamhost has Apache configured to intercept "/stats" URLs before it can even get to ochiba, so other than asking for them to turn that off, I can't think of anything that can be done.