Re: PHP4/Apache: .php files OK, <?php fails

From: Date: Sun, 07 Jan 2001 11:13:08 +0000
Subject: Re: PHP4/Apache: .php files OK, <?php fails
References: 1  Groups: php.install 
Request: Send a blank email to php-install+get-1484@lists.php.net to get a copy of this message
Sorry to reply to my own post, but if anyone wants to take a look at my web site, the problem code is demonstrated on the main page: http://www.uglysoftware.com There's an inline script, which does nothing, and a link to a separate .php file, which works correctly. Thanks for any help! Terry McKiernan Ugly Software On Sun, 7 Jan 2001, The Big Ugly wrote: > I just installed PHP 4.0.4 on Apache 1.3.14 running on RH Linux 7.0 (i386) > and it's all looking pretty good, except that the inline <?php tags don't > work. A file ending in .php is recognized just fine by Apache and > executed properly. > > 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. > > For example, this (test1.htm) does not work: > > <html> > <head><title>Inline PHP</title><head> > <body> > Some stuff before the PHP<br> > <?php echo("a line printed by PHP"); ?><br> > </body> > </html> > > All I get in the browser is the "Some stuff before the PHP" line. > > This, on the other hand, does work when saved as test2.php and loaded > into the browser: > > <?php > $html = <<<ENDH > <html> > <head><title>PHP from Script</title></head> > <body> > <h1>Groovy PHP</h1> > </body> > </html> > ENDH; > echo $html; > ?> > > > So, I'm mystified. PHP and Apache seem to be talking together to some > extent, since the .php files work. Is there something I need to do to > enable the <?php ?> tags? I have tried the short <? ?> and long <script > language="php"> variations with the same results. > > Thanks for any help! > > Terry McKiernan > Ugly Software > > > >

« previous php.install (#1484) next »