Current time: 11-23-2024, 07:27 AM Hello There, Guest! (LoginRegister)


Post Reply 
rewrite to *.php carring out the whole php file instead of executing it
Author Message
iRaS Offline
Junior Member
*

Posts: 13
Joined: Mar 2009
Reputation: 0
Post: #1
rewrite to *.php carring out the whole php file instead of executing it
i had a index.php that starts my portal system and a .htaccess file that rewrites all access to the site not matches file or directory to index.php:
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule [a-z]{2,2}.*$ index.php

(it has to beginn with a 2 letter language flag e. g. de)

but i only got the index.php to download. the index.php file should run through php-parser...

this is the way i did it all the times (also on my server running vhcs2). it have to work.

also ForceType? application/x-httpd-php does not work.

i think this is a problem of fastcgi. im using fcgid - formerly i used apache2-mod-php...

is there a configuration possibility for apache with fcgid or how to do this logic with fcgid?

anyways: i think using rewriterules to point a non .php url to a .php file is not that unusal...

Quote:Not an ispCP Bug. Please use the forum.
of course it is an bug of ispcp if i had to change the httpd.conf to handle php files with fcgid. and apache have to handle all .php files with fcgid whatever the url is. if the returned file is a application/x-httpd-php it has to go through php-parser.

I added this line to /etc/ispcp/apache/parts/dmn_php2_entry.tpl
AddHandler fcgid-script .php

(also i added this line to all vhosts instead of creating the config file new and restarted apache)

now all .php files will be parsed by php. also if they are accessed by a rewrite rule...
now i had a site where i used the ForceType directive to tell apache that this file have to be parsed with php:

Code:
<File de>
  ForceType application/x-httd-php
</File>

but with the fcgid handler only .php files - and not all files of type application/x-httpd-php - will be parsed by php. so i have to use the SetHandler directive to tell apache that this file have to be parsed with php:

Code:
<File de>
  SetHandler fcgid-script
</File>

but this only returns an internal server error (500). the directory /var/www/virtual/[...]/htdocs has AllowOverride all so that this could not be the problem.

any ideas?

my suexec.log shows this two lines with every new access:
Code:
[2009-03-22 15:25:29]: uid: (2001/vu2001) gid: (2001/vu2001) cmd: de
[2009-03-22 15:25:29]: (8)Exec format error: exec failed (de)
(This post was last modified: 03-23-2009 09:08 PM by iRaS.)
03-23-2009 12:14 AM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #2
RE: rewrite to *.php carring out the whole php file instead of executing it
obviously fcgid cannot find the command "de".

I did not have any problems with rewriting - it has to do with fcgi (or fastcgi) - did you already try fastcgi instead?

Please change your post so that line feeds are shown (put
PHP Code:
[code]...[/code
around it).

/J
(This post was last modified: 03-23-2009 06:09 PM by joximu.)
03-23-2009 06:08 PM
Visit this user's website Find all posts by this user Quote this message in a reply
iRaS Offline
Junior Member
*

Posts: 13
Joined: Mar 2009
Reputation: 0
Post: #3
RE: rewrite to *.php carring out the whole php file instead of executing it
(03-23-2009 06:08 PM)joximu Wrote:  obviously fcgid cannot find the command "de".

of course it can not find the command "de". it should run the php5-fcgid-starter not "de". "de" is an php file. i told apache that this is an application/x-httpd-php but without success. fcgid still wants to execute it.

i have searched on the web for fcgid configuration and found that fcgid-php don't support extensionless files. so the customers can't do this on webservices with fcgid or fastcgi (its the same) but on webservices with mod-php they can.

right, this is not a bug of ispCP.. its just not satisfing me. a php newbie normally downloading WAMP and programming his website on his pc. WAMP works with mod-php and they can programm some code that won't work on the server even if he has the same php version...

(03-23-2009 06:08 PM)joximu Wrote:  I did not have any problems with rewriting - it has to do with fcgi (or fastcgi) - did you already try fastcgi instead?

no, i have not yet tried fastcgi instead of fcgid. but it works now with the line
Code:
AddHandler fcgid-script .php

this line should only be added if php is available for this vhost. so it have to be in the template for vhosts (*_php2_entry.tpl).

i don't know why it works for you without this line but on every site i found the entry looks like this:

Code:
[...]
AddHandler fcgid-script .php
FCGIWrapper /usr/bin/php5-fcgi-starter .php
[...]
(This post was last modified: 03-23-2009 07:44 PM by iRaS.)
03-23-2009 07:42 PM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #4
RE: rewrite to *.php carring out the whole php file instead of executing it
hm

I used your .htaccess directives from above (in a folder "t2") and it seems to work:
when typing .../t2/de or /t2/xx i'm getting the result of .../t2/index.php

I'm using fastcgi - the config is from RC-very old - I updated ispcp very often...

/J
03-24-2009 09:06 AM
Visit this user's website Find all posts by this user Quote this message in a reply
iRaS Offline
Junior Member
*

Posts: 13
Joined: Mar 2009
Reputation: 0
Post: #5
RE: rewrite to *.php carring out the whole php file instead of executing it
may be it works with fastcgi - don't know. with fcgid it does not (or maybe just on my server not).

Sorry, but i think it should be repaired if it is not working with fcgid. also if it works with fastcgi. or remove fcgid option in installation progress...

i just don't know why you are telling me it works with fastcgi instead of testing it with fcgid. because fcgid should also work according to documentation.

of course the developers should not have extra work just for one man blaming it don't work. thats why you should test it with the same components i used to check if its a bug or misconfiguration on my side.
(This post was last modified: 03-24-2009 07:20 PM by iRaS.)
03-24-2009 04:35 PM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #6
RE: rewrite to *.php carring out the whole php file instead of executing it
Hi iRaS
I don't have to much time to make a fresh installation with fcgi - I have some productive servers around with ispcp and fastcgi (a year ago there was only fastcgi). I can do some tests like the above and give you the chance to evaluate if it's maybe easier to migrate to fastcgi. But I also can ignore this thread totally if you wish.
You could prepare some information how to reproduce the error.
Quote:- .htaccess with rewrite rules (ok - is there)
- an index.php which tells if it's working or not
- some paths/URLs to check and what results are expected
So, there are maybe more people here willing *and able* to help. It's a comunity project.

Cheers
J
03-24-2009 07:09 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)