PDA

View Full Version : chris, the .htaccess forcetype directive...



eMEraLdwPn
11-10-2005, 11:06 PM
i'm trying to move a few of my sites onto a new server, and i've been using your .htaccess trick to parse files with no extensions as php files. i was getting 500 internal server errors on this server and couldn't fix it, so i filled out a trouble ticket and was told "Due to the fact that we run phpsuexec you cannot place PHP settings in your .htaccess files as this will cause 500 errors."

is there any other way for me to keep the same urls? mod-rewrite maybe? i'm clueless...

agua
11-10-2005, 11:21 PM
I too have a server with phpsuexec

I still use htaccess - but use this code - its a little different than the other
AddHandler application/x-httpd-php .html .htm
If that doesn't work - I believe you can something similar with a php.ini ... I'd look this up though as I'm not sure.

eMEraLdwPn
11-10-2005, 11:38 PM
nope, didn't work =\

btw, this is my current .htaccess

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.eguitar-tabs.com
AuthUserFile /home/tabs/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/tabs/public_html/_vti_pvt/service.grp

<Files artistinfo>
ForceType application/x-httpd-php
</Files>
...

agua
11-10-2005, 11:43 PM
Well - I've never seen one like that :confused:

Did you try changing this line
<Files artistinfo>
ForceType application/x-httpd-php
</Files> to this
<Files artistinfo>
AddHandler application/x-httpd-php
</Files>
Its the forcetype which gives the 500 errors. I'm by no means an expert on this - I just remember the problems I had when I was first moved to a phpsuexec server.

Do you use Frontpage to build your sites?

eMEraLdwPn
11-10-2005, 11:48 PM
yeah, i made that change, still got a 500 error. i don't use frontpage, all that stuff above the <Files... is generated by their server. i have that same exact code in the htaccess files on my current server and just added the list of files below it, and everything worked fine

agua
11-10-2005, 11:57 PM
Did you try creating another blank htaccess file and just adding this line
AddHandler application/x-httpd-php .html .htm I think all the stuff in the htaccess file is there if Frontpage extensions are installed - which it sounds like they are. If your not using them - then I don't think you need all the stuff in the htaccess file.

Make a backup though

You now have my complete knowledge of htaccess regards phpsuexec, front page - if that don't ffix it - I'm not sure what will - sorry

eMEraLdwPn
11-11-2005, 12:24 AM
if i remove all that stuff at the top, nothing works at all... i get a 500 error on every page. if i change it from ForceType to AddHandler, i get a 404 instead of a 500, and if i attempt to visit just the page, it shows me all the php code instead of parsing it... btw, thanks for all the suggestions, too bad none work :(.

agua
11-11-2005, 12:31 AM
nm, yup I'm lost.

Maybe ask your host to remove frontpage extensions and start fresh from there.

sorry I can't help more

eMEraLdwPn
11-11-2005, 12:47 AM
np, thanks for the help. anyone else have any ideas? :)

r2d2
11-11-2005, 12:48 AM
Take a look about half way down this page: http://www.javascriptkit.com/howto/htaccess7.shtml

Seems you need to use 'SetHandler' instead of ForceType with phpsuexec.

Chris
11-11-2005, 07:10 AM
Thats a weird setup, sounds like php is setup to run as CGI. Queer.

I've gotten emails for years about this, and this is the first time I've seen this one. Usually the errors involve it not working on Apache 2.0 (when you have to add accept Pathinfo to your .htaccess).

Mike
11-11-2005, 08:40 AM
You know, the exact same is happening to me. Whenever I add a new bit of forcetype code to htaccess I get internal server error. It didn't used to happen, but despite me staying with the same hosting company, its started to happen in the last few months.

That bit of code you recommended agua didn't seem to cure it, anyone know of any other things that could help?

eMEraLdwPn
11-11-2005, 12:19 PM
thanks r2, changed ForceType to SetHandler and it works now! chris, maybe you should add this to your guide if people have been asking about it... it's an easy enough fix :)

Mike
11-11-2005, 12:36 PM
Aha! I just tried what you said r2 and it worked, thanks! Now I can get back to work on the site :)

moonshield
11-11-2005, 01:45 PM
Yea I hade a problem with that at one time as well. It's quite common.