NYCPHP Meetup

NYPHP.org

[nycphp-talk] php include file question

Hise, Jeremy jhise at nextsource.com
Mon Mar 31 14:26:49 EST 2003


I just performed this test.

1) Created a file called inctest.php
2) Contents of inctest.php

<?
	include("./myinc.php");
?>

3) Created file called myinc.php
4) Contents of myinc.php (note there are no <? and ?>)
	
	print("Hello");

5) Loaded up file inctest.php in browser
6) Output is:

	print("Hello");

So it seems to me that you MUST put the PHP code in the INCLUDED file IN <?
and ?> in order for it to be parsed. It doesn't matter that you are
including it from withing PHP and it doesn't matter that it ends with .php.
It will not be parsed if it is not in <? ?>.

This test was run on RH 7.3 with PHP 4.3.0-dev with Apache 1.3.22




-----Original Message-----
From: Analysis & Solutions [mailto:danielc at analysisandsolutions.com]
Sent: Monday, March 31, 2003 2:18 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] php include file question


On Mon, Mar 31, 2003 at 12:52:58PM -0500, Deidra McIntyre wrote:

> <? include("copyright.html"); ?>

Try:
  <?php include('./copyright.html'); ?>

What's your OS and web server?  I found that under PHP 4.3.*, Apache,
NetBSD (and perhaps other combinations) there was a recent change in
behavior where the directories above the included files need to be world
readable and executable (meaning "chmod 705").

What error messages are you getting?  You do have error messages turned
on, right?  This kind of stuff comes in handy, helping you figure it out
for yourself, and if you cant, helps us help you.

The suggestions that you need to edit your include path statement in the 
php.ini file are likely incorrect, since "." is in the default include 
path value already.

Similarly, the file extension doesn't matter, nor does the included file 
need to have <?php ?> in them.

--Dan

-- 
               PHP classes that make web design easier
    SqlSolution.info  | LayoutSolution.info |  FormSolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409


--- Unsubscribe at http://nyphp.org/list/ ---

****CONFIDENTIALITY NOTICE**** The Information in this email and any
attachments are confidential and intended to be reviewed by only the
individual or organization named above. If you have received this email in
error, please immediately notify the sender by return email and delete this
email from your system. Thank You.



More information about the talk mailing list