how to use the PHP path to send something explicitly to the PHP parser?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lkrubner@geocities.com

    #1

    how to use the PHP path to send something explicitly to the PHP parser?

    Hi. I'm messing around with some stuff in an .htaccess file. Among
    other things, I'd like to send my html files to the PHP parser. I'd
    also like to rewrite the urls using Apache mod_rewrite, so that the
    query string disappears, but the variables are still recorded. For all
    these tasks, I need to know the PHP path. When I run phpinfo, I see
    this listed as the Path:

    PATH /bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin


    I'm not sure how to use that infomation. Do I use all of it? Some of
    it?

  • Justin Koivisto

    #2
    Re: how to use the PHP path to send something explicitly to the PHPparser?

    lkrubner@geocit ies.com wrote:[color=blue]
    > Hi. I'm messing around with some stuff in an .htaccess file. Among
    > other things, I'd like to send my html files to the PHP parser. I'd
    > also like to rewrite the urls using Apache mod_rewrite, so that the
    > query string disappears, but the variables are still recorded. For all
    > these tasks, I need to know the PHP path. When I run phpinfo, I see
    > this listed as the Path:
    >
    > PATH /bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin[/color]

    The path in php is where the interpreter will look for system commands
    when a full path is not provided. For instance:
    <?php $contents = `ls -fl`; ?>

    PHP will look in each of the PATH directories for the ls command:
    /bin/ls
    /usr/bin/ls
    /sbin/ls
    /usr/sbin/ls
    /usr/local/bin/ls
    /usr/local/sbin/ls

    If none of the above are found, then you will get an error...
    [color=blue]
    > I'm not sure how to use that infomation. Do I use all of it? Some of
    > it?[/color]

    None of it?

    ..htaccess:
    -----------
    # Send all .html files through the php interpreter
    AddType application/x-httpd-php .html


    # mod rewrite to rewrite article/2005-10-03.html
    # to article/view.php?date=2 005-10-03 without
    # changing any links in the site
    RewriteEngine On
    RewriteRule ^article/([^.]+)\.html$ article/view.php?date=$ 1 [L]
    -----------

    If you're trying to do something other than that, please explain it better.

    --
    Justin Koivisto, ZCE - justin@koivi.co m

    Comment

    • lkrubner@geocities.com

      #3
      Re: how to use the PHP path to send something explicitly to the PHP parser?


      Justin Koivisto wrote:[color=blue]
      > .htaccess:
      > -----------
      > # Send all .html files through the php interpreter
      > AddType application/x-httpd-php .html
      >
      >
      > # mod rewrite to rewrite article/2005-10-03.html
      > # to article/view.php?date=2 005-10-03 without
      > # changing any links in the site
      > RewriteEngine On
      > RewriteRule ^article/([^.]+)\.html$ article/view.php?date=$ 1 [L]
      > -----------[/color]

      Thanks much for the reply. I take that this line:

      AddType application/x-httpd-php .html

      can be read as something like "add the html type to the php
      application"??? What does "x-httpd-php" mean?

      Comment

      • Justin Koivisto

        #4
        Re: how to use the PHP path to send something explicitly to the PHPparser?

        lkrubner@geocit ies.com wrote:[color=blue]
        > Justin Koivisto wrote:
        >[color=green]
        >>.htaccess:
        >>-----------
        >># Send all .html files through the php interpreter
        >>AddType application/x-httpd-php .html
        >>
        >>
        >># mod rewrite to rewrite article/2005-10-03.html
        >># to article/view.php?date=2 005-10-03 without
        >># changing any links in the site
        >>RewriteEngi ne On
        >>RewriteRule ^article/([^.]+)\.html$ article/view.php?date=$ 1 [L]
        >>-----------[/color]
        >
        > Thanks much for the reply. I take that this line:
        >
        > AddType application/x-httpd-php .html
        >
        > can be read as something like "add the html type to the php
        > application"??? What does "x-httpd-php" mean?[/color]

        That line tells apache to treat all the .html files as the
        "applicatio n/x-httpd-php" - which is where .php files are also sent.
        x-httpd-php is the PHP interpreter...

        --
        Justin Koivisto, ZCE - justin@koivi.co m

        Comment

        Working...