Any php5 experts?

Discussion in 'PHP' started by mjewel, Feb 15, 2008.

  1. #1
    I'm having a script problem with an upgrade from php4 to php5 and phpsuexec enabled.

    I have a script "foo" which is executed without the php extension i.e. "foo" resides in the "test" directory i.e. www.domain.com/test

    inside the "test" directory the htacess file has:

    <files foo>
    SetHandler application/x-httpd-php5
    </files>

    or

    <files foo>
    ForceType application/x-httpd-php5
    </files>


    which allows "foo" to be executed without the .php extension when it is called by www.domain.com/test/foo

    With php4, www.domain.com/test/foo/ "trailing slash" would also work.

    With php5, the addition of the trailing slash does not execute the script. I am thinking this is because "foo" is a virtual directory? The script dynamically creates pages i.e. www.domain.com/test/foo/widget.html etc.

    If anyone can shed light on why I am having the problem with php5 and not php4? Any suggestions for a solution?
     
    mjewel, Feb 15, 2008 IP
  2. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Have you tried using mod_rewrite to change the url from foo/ silently to foo?

    Jay
     
    jayshah, Feb 15, 2008 IP
    mjewel likes this.
  3. mjewel

    mjewel Prominent Member

    Messages:
    6,693
    Likes Received:
    514
    Best Answers:
    0
    Trophy Points:
    360
    #3
    No, I haven't. Do you have an example I could try? Would that go in the root .htaccess or the directory .htaccess?

    Thank you.
     
    mjewel, Feb 15, 2008 IP
  4. jnestor

    jnestor Peon

    Messages:
    133
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I suspect it doesn't have anything to do with PHP 5 vs PHP 4 at all.

    Is this a script you wrote, a script you bought or a script someone wrote for you?

    Have you always used it with urls like: www.domain.com/test/foo/widget.html

    The classic way to do this is to put the script in a normal php file foo.php and then use mod rewrite to change the url.

    Something like: RewriteRule foo/(.*).html foo.php?id=$1 [L]

    I haven't checked the syntax so it may be wrong but that's the general idea.
     
    jnestor, Feb 15, 2008 IP
  5. mjewel

    mjewel Prominent Member

    Messages:
    6,693
    Likes Received:
    514
    Best Answers:
    0
    Trophy Points:
    360
    #5
    It is an older script that the original author stop supporting. I've used it for years, and it only breaks with php5. I use seven different hosts and it has broken only with an upgrade to php5. I'm forcing it to use php4, but since php4 is no longer going to be supported, it is due to be completely dropped by hosting companies.

    The silent rewrite suggested above seems to be working, so this may be a work around.

    RewriteRule ^(.+)/$ http://www.domain.com/test/foo/$1 [L]
     
    mjewel, Feb 15, 2008 IP