Dreamhost, pretty url's and videotape...

Permalink
We'll start with the facts:

Concrete 5.1.0 (Upgraded from original 5.1.0RC1 install)

http://stage.boostfoundation.org/php.php...

When I enable pretty urls, I get a pretty bland page stating 'No input file specified'

A minimal amount of research has led me to believe that PHP running as a CGI on Dreamhost mixed together with mod_rewrite has somehow created a cocktail that makes it so the PHP CGI binary doesn't know where the file it's being told to load is (index.php).

For example:

http://stage.boostfoundation.org/about...

instead of:

http://stage.boostfoundation.org/index.php/about...

...yields this curious uninformed error.

Another Dreamhosted site I have on a different webserver is:

http://jeremeclaussen.com/php.php...

The site is under heavy development and looks like crap, but there's a phpinfo output that works with pretty URL's.

One would be quick to notice that the working instance is on Apache 2.0 and the failed instance is on Apache 2.2.

I'm just trying to figure out if there are other differences.

Somewhere I saw a guide to running it through fastcgi so you could set a few extra environment variables and have a customer php.ini.

I'd rather just figure out the real problem so C5 is more bullet proof for broad distribution.

jereme
 
jereme replied on at Permalink Reply
jereme
One thing I noticed fairly quickly is that phpinfo() isn't printing environment variables on the boostfoundation.org site, but it is on jeremeclaussen.com.

Not sure if this is an indicator that they need to be there for it to run, or if they are even actually missing.

I've added dumps of the $_SERVER hash to the top of both sites for debugging purposes...
Remo replied on at Permalink Reply
Remo
I've fixed all my rewrite problems starting with this:

1. call a phpinfo file with info.php/pathinfo. Sometimes not even this works!

2. try adding [R] at the end of the rule, this way you can see what url apache (and isapi_rewrite too!) are generating. easier to test the rules this way.
andrew replied on at Permalink Reply
andrew
because I remember having the exact same problem at Godaddy hosting and doing nothing...and yet the problem has rectified itself (i.e. - I can use pretty URLs on Godaddy).

I do believe you're correct in that .htaccess is causing requests to not even make it to the right file.
Ender27182818 replied on at Permalink Reply
Ender27182818
Thanks for the instructions, they work. I just barely did this with my pretty URL setup on DreamHost. In cast it isn't clear to other readers, you have to follow all of the steps outlined in the wiki

- copy the php.ini file
- create the script wrapper
- set permissions
- set up .htacces (with your rewrite rule after the php-cgi stuff)

That's all. Easy.
lousyplanet replied on at Permalink Reply
Not sure if anybody is still seeing this thread, but a really easy solution that worked for me was simply adding a ? after the target file in the .htaccess text.

So in the case of concrete5 on dreamhost, you'd take this line
RewriteRule ^(.*)$ index.php/$1 [L]


and change it to

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


That worked for me without any additional changes.
digitelle replied on at Permalink Reply
OMG @lousyplanet I was struggling with this problem and the addition of that little "?" solved everything!!
vinnividivicci replied on at Permalink Reply
+1 for this solution. Works for me, running on Dreamhost and the latest version of Concrete5
Aboreal replied on at Permalink Reply
Wow, this is the best solution. Thanks!
quynh replied on at Permalink Reply
+1 resolved on Dreamhost
admin replied on at Permalink Reply
Awesome this works instantly on Dreamhost! Does anybody know or care to explain why?
jordanlev replied on at Permalink Reply
jordanlev
There is a certain optional behaviour of PHP where it takes everything past the ".php" in a url and treats it as if it were a "querystring" (all the stuff after a question mark in a url). C5 uses this to determine what the path is of the page that's being requested (for example,http://example.com/about-us gets rewritten by htaccess tohttp://example.com/index.php/about-us,... then C5 sees that what follows "index.php" is "/about-us", and looks up the page based on that path).

Now, the problem is that some servers for whatever reason are configured to not treat the stuff that follows ".php" in the URL in this way, so basically C5 doesn't receive that path that follows index.php in the rewritten url. Apparently this is the case with Dreamhost (sometimes, because other time it just works fine I believe -- weird).

So I think putting the question mark after that forces it to see what follows as a "querystring" (because recognizing the question mark is standard across every server configuration in the universe), and hence pass the path along to C5 so it knows which page to serve.

I'm just guessing though -- I don't know for sure.

-Jordan
hopskipjumperoo replied on at Permalink Reply
lousyplanet - thank you, thank you, thank you! The ? fixed my pretty url problem on dream host.
miguelgilmartinez replied on at Permalink Reply
miguelgilmartinez
It worked!!!! Thanks!!!
carrielizabethwatson replied on at Permalink Reply
Thank You!!!! That "?" Fixed it!!!
havedampton replied on at Permalink Reply
havedampton
AWESOME!!! It's worked for me on every Dreamhost site. THANK YOU!
jereme replied on at Permalink Reply
jereme
After failing at this left and right, I finally arrived at a half-way semi acceptable solution. It's obvious DH has an issue on some of their servers and not on others.

The solution is to follow the directions for running a custom php.ini, however there's one exception.

First of all, the directions are at:

http://wiki.dreamhost.com/PHP.ini...

The exception is that copying the default php.ini file should be:

cp /etc/php5/cgi/php.ini $HOME/example.com/cgi-bin/php.ini



(note the addition of cgi in the src dir.)

After following these directions, pretty url's on this installation work like a champ.

Jereme
andrew replied on at Permalink Reply
andrew
Right now we're really adding to our FAQs - to the point where pretty soon our current solution of just listing them all is going to need some tweaking. ;-) However, this is definitely going in there. Thanks for putting in the work to figure this out.

Heh, and regarding that PHP page on their wiki: wow! A little bit complicated, eh? ;)
jereme replied on at Permalink Reply
jereme
What gets me is that they claim there is no issue. But when I re-implement their php5-cgi with seemingly no changes it works.

But hey, it's free non-profit hosting I guess.

I could always grab a phpinfo from the wrapper version and a phpinfo from normal and try to spot the fly on the wall. However, they don't seem to give a crap.

Plus, the site is non-profit and we're not paying, so why would they give a crap?
neptune replied on at Permalink Reply
neptune
It appears that the php.ini needs to be inside your site directory as outlined in these steps in order for the .htaccess to accomplish it's function. So, follow what Ender posted up above and you will be set.
jereme replied on at Permalink Reply
jereme
I've created updated instructions for running on dreamhost that yield much better performance.

See my post at:

http://www.concrete5.org/community/forums/installation/dreamhost_ph...
olay replied on at Permalink Reply
olay
I'm experiencing this problem, i think, with a uk host so that when mod_rewrite is on I experience the following:

"No input file specified" page as decribed above.

Fortunately my hosters seem to have a good level of support and offer to help out if i can point out what needs doing/installing to resolve it then they will consider it.

Is anyone able to specify what the problem is that causes this error?

Alternatively do you think the dreamhosts workaround is universal?
jereme replied on at Permalink Reply
jereme
I was recently confronted with getting Pretty URL's to work on DreamHost again.

Here's my guide:

http://jeremeclaussen.com/Blog/2009/10/20/concrete5-pretty-urls-and...
mech7 replied on at Permalink Reply
There must be a better way to this.. Wordpress and CakePHP run fine with mod rewrite on dreamhost only Concrete seems to have problems with me..

Also I dont have any shell access so I cannot copy the php.ini :'(
jereme replied on at Permalink Reply
jereme
mech7,

See my updated version. These hacks can be performed with only ftp access:

http://jeremeclaussen.com/blog/2010/3/30/concrete5-pretty-urls-and-...
crikey replied on at Permalink Reply
Hey dude,

Thanks for all your efforts here.

cheers
jereme replied on at Permalink Reply
jereme
Actually there's an updated version on my blog that details a solution very similar to what you have arrived at. You will need to make one further change in order to avoid all possible problems when running php5-fcgi.

For full details see:

http://jeremeclaussen.com/blog/2010/3/30/concrete5-pretty-urls-and-...
BrandiLinn replied on at Permalink Reply
I used the method described at http://jeremeclaussen.com/blog/2010/3/30/concrete5-pretty-urls-and-...

Is this supposed to be done along with something? It did stop giving me "No input file specified," but instead is redirecting to the home page; oddly, not to its own, but to a higher one.

To explain: I am, quite frankly, in way over my head. Presently, to try to decide which will work best for a project I'm working on, I actually have multiple CMSs installed on one site. I was originally going to try using WordPress, since it was the only one I'd done anything with before, but it was looking like it was going to be overly complicated; so I made sub-directories to experiment with with C5 and a couple others.

I've got the RewriteBase in the .htaccess file put in for the correct subdirectory and config/site.php has
define('REDIRECT_TO_BASE_URL', false);
as described in the installation thing (http://www.concrete5.org/documentation/installation/installing_conc... ). I would assume that, even if the redirect is wrong, that it would at least go back to the subdirectory's index, since I have Concrete5 completely contained in there. Of course, I don't really want it to do that, either; I want it to simply not redirect.

So... please pardon any clear idiocy I may be showing... but can I get any help on this?
BrandiLinn replied on at Permalink Reply
I've since cleaned stuff up and have only C5 in now, and it seems to be working fine. So, nevermind. ^^;