what's wrong with my htaccess?

what's wrong with my htaccess?

Posted by: critical15
Posted on: 2008-07-30 11:56:00

Hi - have a simple problem here. I'm trying to use a custom php.ini, so I followed http://wiki.dreamhost.com/PHP.ini. I made my cgi-bin folder (subdomain.dreamhosters.com/cgi-bin), and successfully copied php.ini & php.cgi. Then I copy and paste, using pico, the exact text of the .htaccess file into a new .htaccess in subdomain.dreamhosters.com. I try a phpinfo(), and get a 500 error. Of course if I delete my .htaccess then phpinfo() works, from the DH php.

I am *positive* that php.cgi and php.ini are both in the cgi-bin folder, which is in my subdomain.dreamhosters.com folder.

Seems like it should've been easy, any idea what went wrong?

Re: what's wrong with my htaccess?

Posted by: sdayman
Posted on: 2008-07-30 12:11:00

How did you try the phpinfo()? I have a script called version.php on my websites with the following:

<?php 
echo phpinfo();
echo "\n";
?>


-Scott

Re: what's wrong with my htaccess?

Posted by: critical15
Posted on: 2008-07-30 13:40:00

Mine is similar, simply <?php phpinfo(); ?>. This works fine when I delete or remove the .htaccess file, which is why i believe the problem is there. What could it be?

Re: what's wrong with my htaccess?

Posted by: sdayman
Posted on: 2008-07-30 14:07:00

Either your htaccess file is improperly formatted, or it's syntax. By formatting, I mean something like creating it in Notepad and then uploading with bad linefeeds.

Anyhow, post it here and X out any sensitive info and we'll look at it.

-Scott

Re: what's wrong with my htaccess?

Posted by: critical15
Posted on: 2008-07-30 14:23:00

The file is simply:

Options +ExecCGI
Action php-cgi /cgi-bin/php.cgi
AddHandler php-cgi .php

... which I copied from the wiki, so I don't think its the syntax. Formatting sounds more likely, what is the proper way to write and upload the file then?

Re: what's wrong with my htaccess?

Posted by: sdayman
Posted on: 2008-07-30 14:33:00

Weird, my .htaccess looks like this:

Options (plus)ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi


Maybe order matters.

As for formatting, I do most of my text editing in either vi or BBEdit. Those always seem to work.

-Scott

Re: what's wrong with my htaccess?

Posted by: critical15
Posted on: 2008-07-30 15:05:00

Switched order, still no good. I made edits with vi, made sure that the it was *exactly* the same (see below), and i'm still getting the 500 error. Really stumped.

Options +ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi


Re: what's wrong with my htaccess?

Posted by: sdayman
Posted on: 2008-07-30 15:15:00

Does the cgi-bin directory have both the .cgi and .ini files? Did you run the php-copy.sh script, and did it give any warnings or errors?

Which setup did you use? PHP4, PHP5, or the General script? Is your website (under Domains -> Manage Domains -> Edit) set to run PHP4 or PHP5?

-Scott

Re: what's wrong with my htaccess?

Posted by: critical15
Posted on: 2008-07-30 15:32:00

Both the .cgi & the .ini are in the cgi-bin folder. I copied, pasted and executed the php-copy.sh script for PHP5 (where the first two lines were changed to read:

CGIFILE="$HOME/subdomain.dreamhosters.com/cgi-bin/php.cgi"
INIFILE="$HOME/subdomain.dreamhosters.com/cgi-bin/php.ini"

The script went fine, it was creating the .htaccess that killed the progress. I used the PHP5 script, should I try the General one instead?

Re: what's wrong with my htaccess?

Posted by: sdayman
Posted on: 2008-07-30 17:54:00

Is your site set to run as PHP5? Check under Manage Domains.

-Scott

Re: what's wrong with my htaccess?

Posted by: critical15
Posted on: 2008-07-30 18:14:00

Yes it is. And when I remove or rename the faulty .htaccess file DH's PHP 5.2.6 takes over fine.

Re: what's wrong with my htaccess?

Posted by: critical15
Posted on: 2008-07-30 23:28:00

Solved - I asked DH support, and they helped even though this is related to custom php.ini stuff. It worked, but the answer was so over my head I need to share it. Thanks for the pointers folks.

Re: what's wrong with my htaccess?

Posted by: sdayman
Posted on: 2008-07-31 06:44:00

Ok, interesting. Mine is also set to g-w, which is the default when you use the mkdir command.

-Scott

Re: what's wrong with my htaccess?

Posted by: netdcon
Posted on: 2008-07-31 11:26:00

In reply to:

The part of apache that makes it so that your scripts run as your user didn't like the permissions that you had set on your cgi-bin directory. Apparently if anyone except you can write to the directory, it won't let you run the cgi (in this case php.cgi)


An excellent security setting that will spare many DH "talented amateur web designers" the hand-wringing pain of a hacked site. cool

Tags: bin folderhtaccesscgi bin