Re: Adding a single php file to .htaccess.
| From: | Stut | Date: | Sun, 24 Aug 2008 14:21:21 +0000 |
| Subject: | Re: Adding a single php file to .htaccess. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278587@lists.php.net to get a copy of this message | ||
On 24 Aug 2008, at 15:05, Dotan Cohen wrote:
On one particular server, all *.html files are written in Python. I uploading a few PHP files to the directory, but they must also have .html extensions (they are replacing files that _were_ python, but it is rather important that the filename stay the same and I'd rather avoid rewrite). I figured that it would be easy enough to add a separate line in .htaccess for each PHP file, but I'm not getting it for some reason. This is the .htaccess line that lets the system parse *.html files as Python: AddHandler cgi-script .html This is what I'm trying to add to have the system parse specific files as PHP: AddType application/x-httpd-php filename.html I know that I am doing something wrong, but I do not know what. Any ideas? Thanks!In theory all you need to do is add a hash-bang line to the start of the PHP scripts. This should work... #!/usr/bin/env php If that's the first line then Apache should execute the script with PHP. If that doesn't work try replacing it with... #!/path/to/php -Stut -- http://stut.net/