Re: curious (and frustrating) php/apache behavior
| From: | Petr Smith | Date: | Sat, 29 Oct 2005 19:19:38 +0000 |
| Subject: | Re: curious (and frustrating) php/apache behavior | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-224822@lists.php.net to get a copy of this message | ||
Hi,
why don't you use normal php include (require) functions? Why do you want to mix apache server side includes with php code? There is nothing php include can't do..
Just change all
<!--#INCLUDE virtual="xxxx"-->
to
<? include('xxxx'); ?>
Petr
Don Brown wrote:
We're having a problem getting more than one imbedded PHP script to execute in our Apache-served pages. We're using Apache 2.0.40 server-side includes. We wish to include multiple PHP scripts into our pages but are only succeeding in having the first included PHP script executed; the rest are ignored or misinterpreted as HTML... Thank you in advance for any help you provide. This works: $ cat php1.txt <?php echo "this is the first php include"; ?> $ cat test.shtml <html><body> <!--#INCLUDE virtual="/php1.txt"--> <br>this came from html </body></html> Producing the expected result from the browser (http://myhost/test.shtml): this is the first php include this is html However, this does not produce the expected three line result: $ cat php1.txt <?php echo "this is the first php include"; ?> $ cat php2.txt <?php echo "this is the second php include"; ?> $ cat test.shtml <html><body> <!--#INCLUDE virtual="/php1.txt"--> <br> this came from html <br> <!--#INCLUDE virtual="/php2.txt"--> </body></html> Producing from the browser (http://myhost/test.shtml): this is the first php include this is html This DOES work: $cat test.php <html><body> <?php echo "this is from the first php block"; ?> <br> this is from html <br> <?php echo "this is from the second php block"; ?> </body></html> Producing from the browser (http://myhost/test.shtml): this is from the first php block this is from html this is from the second php block Don Brown Co-Founder, Utah Skies "Ski champagne powder by day, surf diamond-studded velvet by night..."