By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,490 Members | 3,266 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,490 IT Pros & Developers. It's quick & easy.

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

P: n/a
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?

Nov 1 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
lk******@geocities.com wrote:
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
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...
I'm not sure how to use that infomation. Do I use all of it? Some of
it?


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=2005-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 - ju****@koivi.com
http://koivi.com
Nov 1 '05 #2

P: n/a

Justin Koivisto wrote:
.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=2005-10-03 without
# changing any links in the site
RewriteEngine On
RewriteRule ^article/([^.]+)\.html$ article/view.php?date=$1 [L]
-----------


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?

Nov 2 '05 #3

P: n/a
lk******@geocities.com wrote:
Justin Koivisto wrote:
.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=2005-10-03 without
# changing any links in the site
RewriteEngine On
RewriteRule ^article/([^.]+)\.html$ article/view.php?date=$1 [L]
-----------


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?


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

--
Justin Koivisto, ZCE - ju****@koivi.com
http://koivi.com
Nov 2 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.