Re: Adding a single php file to .htaccess.
| From: | Stut | Date: | Sun, 24 Aug 2008 15:36:45 +0000 |
| Subject: | Re: Adding a single php file to .htaccess. | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278594@lists.php.net to get a copy of this message | ||
On 24 Aug 2008, at 16:30, Dotan Cohen wrote:
2008/8/24 Stut <stuttle@gmail.com>:It depends what version of Apache you're using, but it would be a Files section something like this (Apache 2 filter in this example, but untested - I've never needed to do this)... <Files firstfile.html>I'm confused. A #! line does not harm the portability of a PHP script in any way whatsoever, and if you use the env version rather than an absolute path then it should work out of the box on 99% of Linux servers and will also work everywhere else because that line will be ignored by the PHP interpreter. In what way do you think it harms the portability of the PHP file itself?Because I have a few other files that do not have the shebang line that I will likely need to put on that server in the future, and I did not want to have to remember to add the shebang line for each one. However, the flaw in my thinking is that I would in any case have to add the line to .htaccess for each file, which means SSHing in instead of FTPing. So the shebang line is in fact best! In any case, I would still like to know what line to add to .htaccess to have it parse a specific file as php. But it is no longer critical for this project because I will use the shebang line.
SetOutputFilter PHP
SetInputFilter PHP
</Files>
Repeat for each file. For other versions of Apache check the installation section of the PHP manual.
-Stut
--
http://stut.net/