note 30735 deleted from function.include by philip

From: Date: Fri, 23 May 2003 04:53:47 +0000
Subject: note 30735 deleted from function.include by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-48859@lists.php.net to get a copy of this message
Note Submitter: tjic@tjic.com ---- If you write a file 'a.php' such that it: 1) includes a file <B> by HTTP 2) specifies a webserver that has PHP processing (perhaps the same server that is serving a.php) 3) the file <B> has a name that invokes server php processing (such as 'b.php') then you should be aware that the file b.php will be fully processed to generate HTML by the webserver before it is delivered to file 'a.php'. This means that if all three of the above things are true, you can not include a file that supplies function definitions or variable manipulation. E.g.: at site foobar.net: a.php: <? echo "X"; include("http://www.foobar.net/b.php"); echo "Y"; echo $z; ?> b.php: <? echo "b"; $z="Z"; ?> will result in an HTML document when a.php is viewed: XbY and not XbYZ as might be desired. The secret is to rename file b.php to something that will not cause the webserver to evaluate it as PHP. "b.phpINCLUDE" will most likely work. If you are using apache, look in your httpd.conf file for a line that starts "AddType application/x-httpd-php" and note the file extensions specified there. Now pick an extension that is not on that line. TJIC (http://www.tjic.com)

« previous php.notes (#48859) next »