Re: [PHP] Include Bug?

2003-06-06 Thread Steven Walker
I would recommend using your .htaccess file, or ini_set, or something
else to set your include_path variable
Thanks Joel, that worked nicely.

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Include Bug?

2003-06-06 Thread joel boonstra
On Fri, Jun 06, 2003 at 10:19:10AM -0700, Steven Walker wrote:
> I get it... so instead I should use:
> 
> include("/usr/home/sites/www.walkereffects.com/web/test/include.php")

I would recommend using your .htaccess file, or ini_set, or something
else to set your include_path variable to contain
'/usr/home/sites/www.walkereffects.com/' or something like that.  Your
include() call can then just look like:

  

and it'll work from anywhere, regardless of where the file that's doing
the including is located [1].

As a bonus, if you ever change hosts, or your host re-organizes its
directory structure, and all of your includes rely on the include_path,
simply re-set include_path, and your site works again.

joel

[1] Of course, the order of directories in your include_path matters,
too.  If it contains '.:/usr/home/sites/www.walkereffects.com/', then a
file matching in the current working directory will take precedence over
the one in your site root.  So keep that in mind...

-- 
[ joel boonstra | gospelcom.net ]

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



Re: [PHP] Include Bug?

2003-06-06 Thread Steven Walker
I get it... so instead I should use:

include("/usr/home/sites/www.walkereffects.com/web/test/include.php")

Thank you,

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]
On Friday, June 6, 2003, at 10:08 AM, Rasmus Lerdorf wrote:

Uh, http://www.walkereffects.com/test/include.php is not a "full path
name", that is a URL.  That will make an HTTP request to your web 
server
for /test/include.php which will of course get parsed by PHP and you 
will
only get the parsed output which means you won't see any variables or 
any
PHP tags at all for that matter.  This is doing exactly what you are
asking it to do.

-Rasmus

On Fri, 6 Jun 2003, Steven Walker wrote:

Hello,

I have found troubling behavior using include() that looks like a bug.
When I specify an include file by a full path name versus a relative
path, PHP acts as though it has included the file, but variable and
constant definitions in the include file are not coming through. My
server is running PHP 4.3.1.
Here is an example:

I created a file called 'include.php', with the following contents:
"; //should print -only- if included,
right?
$testVar = "test succeeded!";
?>
Then I created 'test.php', with the following contents:
	
		$testVar = "not defined";	//include.php should redefine this as 
'test
succeeded!'
		//include("http://www.walkereffects.com/test/include.php";); // full
path
		include("include.php"); // relative path
		echo $testVar;
	?>

Using the relative path version of include outputs:
include.php opened
test succeeded!
And using the full path results in:
include.php opened
not defined
This doesn't seem right! Any ideas how I can work around this?

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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


Re: [PHP] Include Bug?

2003-06-06 Thread Rasmus Lerdorf
Uh, http://www.walkereffects.com/test/include.php is not a "full path
name", that is a URL.  That will make an HTTP request to your web server
for /test/include.php which will of course get parsed by PHP and you will
only get the parsed output which means you won't see any variables or any
PHP tags at all for that matter.  This is doing exactly what you are
asking it to do.

-Rasmus

On Fri, 6 Jun 2003, Steven Walker wrote:

> Hello,
>
> I have found troubling behavior using include() that looks like a bug.
> When I specify an include file by a full path name versus a relative
> path, PHP acts as though it has included the file, but variable and
> constant definitions in the include file are not coming through. My
> server is running PHP 4.3.1.
>
> Here is an example:
>
> I created a file called 'include.php', with the following contents:
>  echo "include.php opened "; //should print -only- if included,
> right?
>   $testVar = "test succeeded!";
>   ?>
>
> Then I created 'test.php', with the following contents:
>  $testVar = "not defined";   //include.php should redefine this as 
> 'test
> succeeded!'
>   //include("http://www.walkereffects.com/test/include.php";); // full
> path
>   include("include.php"); // relative path
>   echo $testVar;
>   ?>
>
> Using the relative path version of include outputs:
>   include.php opened
>   test succeeded!
>
> And using the full path results in:
>   include.php opened
>   not defined
>
> This doesn't seem right! Any ideas how I can work around this?
>
> Steven J. Walker
> Walker Effects
> www.walkereffects.com
> [EMAIL PROTECTED]

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



[PHP] Include Bug?

2003-06-06 Thread Steven Walker
Hello,

I have found troubling behavior using include() that looks like a bug. 
When I specify an include file by a full path name versus a relative 
path, PHP acts as though it has included the file, but variable and 
constant definitions in the include file are not coming through. My 
server is running PHP 4.3.1.

Here is an example:

I created a file called 'include.php', with the following contents:
	
		echo "include.php opened ";	//should print -only- if included, 
right?
		$testVar = "test succeeded!";
	?>

Then I created 'test.php', with the following contents:
	
		$testVar = "not defined";	//include.php should redefine this as 'test 
succeeded!'
		//include("http://www.walkereffects.com/test/include.php";); // full 
path
		include("include.php"); // relative path
		echo $testVar;
	?>

Using the relative path version of include outputs:
include.php opened
test succeeded!
And using the full path results in:
include.php opened
not defined
This doesn't seem right! Any ideas how I can work around this?

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]