Thanks Jonathan,
I'm trying to include a file /includes/ from /main/page.php.  In
/main/page.php I use include("includes/");.  When that didn't work,
I tried copying the file to /main/ and including it there and that didn't
work either.  Finally, I tried adding a specific path to the php.ini file
for includes_path and put the files there and that worked.  Then I went and
changed the php.ini file to remove the reference (still trying to get it to
work the way I THINK it should) and then it WORKED!  But ONLY from within
/main/.  Each time I make these changes, I am making a matching change in
the actual include() statement at the top of /main/page.php and I am
restarting apache each time I change php.ini.

So, maybe this is the question.  Can you include a file from /main/page.php
by using a path of /includes/ has functions that do connections and queries to a mysql database.
Even stranger yet, is that I have one other include file called
that has authentication related session functions.  Well, that hasn't worked
at all no matter what, unless I put the functions in /includes/
directly into the file /main/page.php.  Once there, all the functions work
fine.  Otherwise, the only error messages I get are regarding unknown
functions being referenced, yet, I never get an error that the include files
can't be found.  It's all crazy to me.

Currently, both of my include files are called directly with two lines like:


They are both located in /main/ along side page.php which is calling them.
They both seem to work this way, but as soon as I place them in /includes/
and try to call them using:


I get errors saying that the functions can't be found, however, no errors
saying it can't find the include files??

Lastly, even with both include files in /main/ I still have some strange
problem with my file because the single function that is in
there won't work unless the function is pasted directly into /main/page.php.

I think I've made this message way too long but I appreciate your help.
I've got the page working reliably with the functions all pasted into
page.php but not while including those functions.  I just can't think of
what could be making it difference.  The functions are all the same, just
running from an include file is a problem.

Thanks again, just writing this up has helped to make more sense to me.  I
think the crux of the whole thing is the path.  I'm using to including files
in ASP and those can be relative so something like ../includes/
works great.


"Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message
> #1. You may want to double-check the path where you're calling it from in
> case you're working with subdirectories.
> Let's saying you access a page at which calls
> Then, includes the file at
> However, the include's base directory
> will still be in page.php - the directory won't change to includes, so for
> to include, it has to say:
>   include("includes/");
>   include("");
> Otherwise, it will be trying to include because
> page that started the whole chain reaction of includes is located at
> #2. If you have error reporting turned off, and there is a parsing error
> your files, the page may just die without giving a reason. Try turning off
> any error reporting and also access those include files like
> directly in your web browser to see if PHP reports any errors. You may
> to change the extension to something like for the web
> to recognize the request correctly.
> #3. Please give us a little more detail on the errors you're getting (any
> specific messages would be nice).
> - Jonathan
> -----Original Message-----
> From: Rick Emery [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 27, 2002 3:42 PM
> To: 'Brad Melendy'; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] include() statement hell!
> did you start each include file with:
> <?php
> ?>
> If not, PHP treats the code within as straight text
> -----Original Message-----
> From: Brad Melendy [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 27, 2002 5:03 PM
> Subject: [PHP-DB] include() statement hell!
> Ok, I've spent some time reading the docs at and I'm still
> After a couple hours, I have an include file working with a statement
> include ("");
> However, to add to my confusion, I've got a second include file statement
> the next line:
> include ("");
> And that doesn't work.
> Most crazy of all, if I just put the darn functions all in the PHP file
> is trying to call the include files, everything works perfectly.
> So far I have my include_path line in the pho.ini file set to no value
> I'm just using include files that exist in the same directory as the
> php file.  this after I could NOT get the files to be properly recognized
> from their own include directory.  As far as I'm concerned, you should be
> able to include a relative path with the included filename and have it
> Too bad that doesn't work in PHP.
> So, long story short, I'm about to give up on include statements and just
> copy and paste my functions all over the place.  Does anyone have any
> why this is so difficult for me?  What am I missing?  This stuff is easy
> ASP but PHP is giving me serious heart-ache.  :-(
> Thanks for any tips or suggestions.
> ....Brad
> --
> PHP Database Mailing List (
> To unsubscribe, visit:
> --
> PHP Database Mailing List (
> To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to