Re: [PHP] curious (and frustrating) php/apache behavior

2005-10-29 Thread Richard Lynch
On Sat, October 29, 2005 12:01 pm, 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
>  echo "this is the first php include";
> ?>
> $ cat test.shtml
> 
>
> 

You are using Server Side Include (SSI) here.

SSI is to PHP as a GoCart is to a Ferrarri :-)

*IF* your original page of HTML can be parsed as PHP, you'll have a
lot less frustration and a lot more flexibility using:

instead.

But let's assume that you are:
A) Stuck with the HTML being HTML.
B) Don't need variables/data from php1.txt to transfer to php2.txt
later in the script
C) Are willing to accept the increased HTTP performance hit of 

Re: [PHP] curious (and frustrating) php/apache behavior

2005-10-29 Thread Linda H


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...


I don't know if this is part of your problem, but when you do an include, 
it throws you out of php. So, if there is any php code in the include, you 
can't rely on the include being inside a php block. You must put a php 
block inside the include as well. This is true no matter how you name the 
include file (.php, .inc, .htm).


Linda H 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] curious (and frustrating) php/apache behavior

2005-10-29 Thread Don Brown
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

$ cat test.shtml




this came from 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

$ cat php2.txt

$ cat test.shtml




this came from html





Producing from the browser (http://myhost/test.shtml):
this is the first php include 
this is html 


This DOES work:

$cat test.php





this is from 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..."