Re: [PHP] Nested include/require not working in 5.2



on 11/27/07 1:53 PM, Wolf at lonewolf@xxxxxxxxx wrote:


---- Mike Yrabedra <lists@xxxxxxxxxx> wrote:
on 11/27/07 1:43 PM, Wolf at lonewolf@xxxxxxxxx wrote:


---- Mike Yrabedra <lists@xxxxxxxxxx> wrote:
on 11/27/07 11:46 AM, Jochem Maas at jochem@xxxxxxxxxxxxx wrote:

Mike Yrabedra wrote:

I am not able to use includes or requires in nested files using php 5.2.3
(osx)

Including or Requiring files directly works.

Including files, that also have includes in them, does not.

Say you have this...

-TopDirectory
--index.php (contains include("includes/top.php"); )
--includes (folder)
---config.php (contains echo "crap"; )
---top.php (contains include("config.php"); )

When you load the index.php file you would expect the word "crap" to
show,
but it does not. I think the getcwd is staying specific to the top
folder,
so the path stays the same throughout.

This does not happen in 5.1.6

nothing changed in php - the CWD has always been the dir in which the
explicitly
called script lives in and it does not change because your inside an
included
file.

my guess is your include_path no longer includes '.' so php is not trying
to
find the file
in the directory of the script which is doing the include.


Is there a fix for this or is it PHP causing the problem?





Here is what I have for include_path...

include_path = ".:/usr/local/pear"

Everything seems to be in order?

--
Mike Yrabedra B^)>

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

The first question I have is what does the Error log show?

You should have error reporting turned on so you can see where the script is
barfing on the coding.

Wolf


One more thing, it only does this IF the nested include file is named
'config.php'.

No error is thrown because it is pulling the 'config.php' file from
somewhere, I just do not know where.

If I change the name of the file from 'config.php' to 'config1.php', then
everything works fine.

Is there a way to figure out where and why it is pulling this mystery
'config.php' file from?

--
Mike Yrabedra B^)>

What does the error message log tell you? It should be readily available in
it....

Wolf


The include tag is not throwing any error.

If I call the same file with a read file method, then I get this error....

Warning: readfile(config.php) [function.readfile]: failed to open stream: No
such file or directory in....

Even though the file calling it is in the same directory as 'config.php'



--
Mike Yrabedra B^)>
.



Relevant Pages

  • Re: [PHP] Nested include/require not working in 5.2 (SOLVED)
    ... I am not able to use includes or requires in nested files using php ... in the directory of the script which is doing the include. ... Mike Yrabedra B^)> ...
    (php.general)
  • Re: [PHP] Nested include/require not working in 5.2
    ... I am not able to use includes or requires in nested files using php ... in the directory of the script which is doing the include. ... Mike Yrabedra B^)> ...
    (php.general)
  • Re: [PHP] Nested include/require not working in 5.2
    ... I am not able to use includes or requires in nested files using php 5.2.3 ... in the directory of the script which is doing the include. ... What does the error message log tell you? ...
    (php.general)
  • Re: [PHP] Nested include/require not working in 5.2
    ... I am not able to use includes or requires in nested files using php 5.2.3 ... in the directory of the script which is doing the include. ... Mike Yrabedra B^)> ...
    (php.general)
  • Re: [PHP] PHP console script vs C/C++/C#
    ... My script is taking a longer time to execute than I want. ... I prefer to write in PHP because that is what I know best. ... This is why I am thinking about rewriting my whole script in a C language. ... Perhaps there are different methods I could be using to speed up execution. ...
    (php.general)