Re: PHP4/Apache: .php files OK, <?php fails (fwd)
| From: | CC Zona | Date: | Sun, 07 Jan 2001 11:59:37 +0000 |
| Subject: | Re: PHP4/Apache: .php files OK, <?php fails (fwd) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-33084@lists.php.net to get a copy of this message | ||
In article <Pine.LNX.4.30.0101070303520.10348-100000@uglysoftware.com>,
terry@uglysoftware.com (The Big Ugly) wrote:
> That is, if I write a little PHP script and put it in a file with
> extension .php, and load that into my browser, then it runs just like it
> should.
>
> If I have an HTML file with some of what I'll call "inline" PHP, using the
> <?php ?> construct, the server & browser completely ignore it. I can view
> the page source and see the PHP code; it is just getting ignored as if it
> were an unknown HTML tag.
If a page contains PHP to be parsed, then it's a PHP file regardless of
whether there is also HTML outside of the <?php ?> markers.
The PHP parser parses what's sent to it. Your web server is configured to
send the PHP parser those files with the .php extension, but is not
configured to do likewise with files ending in ".htm". So you have two
choices: reconfigure the web server so that ".htm" files are sent for
parsing too, or rename that file to end in ".php". I'd recommend the
latter. That is, after all, the point of giving it a different extension
in the first place.
--
CC