Forum Moderators: phranque

Message Too Old, No Replies

forcetype application/x-httpd-php

refuses to work

         

ghostcorps

11:54 pm on Sep 15, 2004 (gmt 0)

10+ Year Member



Hi guys

I have been piecing my .htaccess together for the last month and as would be expected from someone who only just heard of the rewrite mod a month ago, I am having my fair share of problems. Not the least of which being that while the set of RewriteRules I have written dont disrupt the page anymore they arn't actually rewritting anything either. So I've left them alone for now and moved to trying to have 'index' parsed as index.php. All my reading says this should work:

<Files index>
forcetype application/x-httpd-php
</Files>

but no dice.

so I added this between the <Files tags:

AcceptPathInfo On
more 500's

more digging found this suggestion

<Files index>
SetHandler application/x-httpd-php
</Files>
but again with the 500's

here is the relavent chunk of my .htaccess

RewriteEngine ON

#the following are my failed attempts.
#<Files index>
#forcetype application/x-httpd-php
#AcceptPathInfo On
#</Files>

#<Files index>
#SetHandler application/x-httpd-php
#</Files>

Options +FollowSymLinks
Options +SymlinksIfOwnerMatch

RewriteBase /site294/fst/var/www/html/bec/fleshmetal/

#~/index.php?main_page=index
RewriteRule ^main/([a-z]+)/$ /bec/fleshmetal/index?main_page=$1

If theres anything anyone can suggest....

please

coopster

12:41 am on Sep 16, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Can you answer a few questions first?
  1. What version of Apache are you running?
  2. What version of PHP are you running?
  3. Is PHP installed as CGI or Apache module?
Note:
phpinfo() [php.net] will give you your answers. Number 3 may not be as obvious for you to find, so using a simple script as follows might be easier. Save it and run it on your server:

<?php 
print php_sapi_name() [php.net];
?>

jdMorgan

12:50 am on Sep 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And another question:

Have you tried enabling php parsing on all php files?


AddHandler server-parsed .php

Another thing to look into with php problems is the load order of mod_php versus mod_rewrite. If php is loaded first, then mod_rewrite can run. If mod_rewrite is loaded first, then control is passed to php before mod_rewrite can rewrite the URLs.

Jim

ghostcorps

12:57 am on Sep 16, 2004 (gmt 0)

10+ Year Member



1. Apache/1.3.22 (though it can be moved to a newer server if need be.)
2. PHP Version: 4.2.2 (Zend: 1.2.0)
3. CGI

I have server_info.php open is there anythgin else there that would help?

[edited by: ghostcorps at 1:28 am (utc) on Sep. 16, 2004]

ghostcorps

1:05 am on Sep 16, 2004 (gmt 0)

10+ Year Member



JD hello again.

I've gotten so much further since you last helped thanks :)

The right order for the commands is something Ive been trying to nail down thanks for bringing it up. Looking at the chunk I posted what should I move where? and should I enable forcetype or SetHandler when trying AddHandler?

ghostcorps

1:27 am on Sep 16, 2004 (gmt 0)

10+ Year Member



CORRECTION
answer to #3 had been updated

coopster

2:32 am on Sep 16, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You know what, I'll bet you are trying to request something like this, correct?
http://www.example.com/
And if you put in something like this, does it work?
http://www.example.com/index
If so, you need to modify your per-directory override (
.htaccess
) file...

DirectoryIndex index 
<Files index>
Forcetype application/x-httpd-php
</Files>

Let's start there. Take everything else out and try that first.

ghostcorps

2:36 am on Sep 16, 2004 (gmt 0)

10+ Year Member



my htaccess now looks liek this
DirectoryIndex index
<Files index>
forcetype application/x-httpd-php
AcceptPathInfo On
</Files>

RewriteEngine ON

i goto www.site.com/dir/dir/index

and get 500 Internal server error

edit: oosp forgot to take out AcceptPathInfo. brb

ghostcorps

10:04 am on Sep 16, 2004 (gmt 0)

10+ Year Member



sorry for the delay. I hope you are still around... I finnally got home and did as you suggested.. my htacess has only this
DirectoryIndex index
<Files index>
forcetype application/x-httpd-php
</Files>

if i manually cut .php out of the URL, index IS parsed as php :)!

also works with

AddHandler server-parsed .php
<Files index>
SetHandler application/x-httpd-php
</Files>

but as the sites script generates the URL with .php included i will always get the error below as soon as i clik a link

Not Found
The requested URL /dir/dir/index.php was not found on this server.

is there a rewrite rule to fix this? or should i listen to my housemate and start looking into alias's

jdMorgan

1:33 pm on Sep 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If your file is named index.php, then use

DirectoryIndex index.php

Jim

coopster

1:41 pm on Sep 16, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



jd,

Normally, yes. But in the first message ghostcorps has stated:


...and moved to trying to have 'index' parsed as index.php

My thought was that ghostcorps is trying to go extension-less. This would mean changing the extensions in the scripts to be just "index" without the

.php
extension. Unless I'm missing something?

jdMorgan

1:56 pm on Sep 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use multiple choices?

DirectoryIndex index.php index

Jim

ghostcorps

2:14 am on Sep 19, 2004 (gmt 0)

10+ Year Member



thanks Jim

No luck though, the script is still calling for index.php. I think Ill give up for now. And get back to gettng the rewrite rules working.... while im here can you please help with my Rewritebase? I'm using the physical path at the moment

/site294/fst/var/www/html/dir/subdir/
where the index.php and .htaccess are in subdir, Or should i use the path that shows in ftp
/home/cris/mainwebsite_html/dir/subdir/

Thing is I dont even know if my base isnt working, al I knwo is the ruls arn't.. is there a set of guidelines for writting the Base anywhere?