RE: [PHP-DB] include() statement hell!

2002-03-28 Thread Jonathan Hilgeman

 So, maybe this is the question.  Can you include a file from
 /main/page.php by using a path of /includes/dblib.inc?

Probably not. PHP can see the whole filesystem, not just the area that is
limited to your account. So, when you try to include /includes/dblib.inc
it is trying to go down to the SYSTEM root and open up a subdirectory called
includes and get the file dblib.inc inside it.

If you copy the dblib.inc to the same directory as page.php, you should only
have to say:
 include(dblib.inc);

However, if you have this layout:
 /your/account/dir/main/page.php
 /your/account/dir/includes/dblib.inc
 /your/account/dir/includes/userlib.inc

Then page.php would have to say:
 include(../includes/dblib.inc);

Which would go back one directory, THEN into the includes subdirectory, and
then it could find dblib.inc

I would definitely add:
 error_reporting(2039);

...to the top of your page.php code to see if you can pick up any errors.
Also, check your error log if you have one (contact your hosting company if
you're not sure). 

I would definitely try to solve this the normal way by finding the problem
with the paths rather than trying to screw with your php.ini or httpd.conf
file - otherwise you'll have a script that might not work if you ever have
to move your scripts or copy them to a development server or something.

- Jonathan

-Original Message-
From: Brad Melendy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 7:27 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] include() statement hell!


Thanks Jonathan,
I'm trying to include a file /includes/dblib.inc from /main/page.php.  In
/main/page.php I use include(includes/dblib.inc);.  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/dblib.inc?

dblib.inc has functions that do connections and queries to a mysql database.
Even stranger yet, is that I have one other include file called userlib.inc
that has authentication related session functions.  Well, that hasn't worked
at all no matter what, unless I put the functions in /includes/userlib.inc
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:

include(dblib.inc);
include(userlib.inc);

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:

include(includes/dblib.inc);
include(includes/userlib.inc);

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 userlib.inc 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/dblib.inc
works great.

...Brad




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




RE: [PHP-DB] include() statement hell!

2002-03-28 Thread JD Daniels


I have found the best way for me is always include with the fullpath ie,

include(/usr/httpd/mysite/include.inc);

or:

include($_SERVER['DOCUMENT_ROOT']/include.inc);

Then you can include files that are elswhere:

include(/usr/httpd/virtual-domain-includes/multi-user-include.inc);

these will work no matter what dir or sub dir the page calling the include
is in...

(I haven't Followed This entire thread.. so sorry if I missed something)

JD

-Original Message-
From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 10:10 AM
To: 'Brad Melendy'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] include() statement hell!


 So, maybe this is the question.  Can you include a file from
 /main/page.php by using a path of /includes/dblib.inc?

Probably not. PHP can see the whole filesystem, not just the area that is
limited to your account. So, when you try to include /includes/dblib.inc
it is trying to go down to the SYSTEM root and open up a subdirectory called
includes and get the file dblib.inc inside it.

If you copy the dblib.inc to the same directory as page.php, you should only
have to say:
 include(dblib.inc);

However, if you have this layout:
 /your/account/dir/main/page.php
 /your/account/dir/includes/dblib.inc
 /your/account/dir/includes/userlib.inc

Then page.php would have to say:
 include(../includes/dblib.inc);

Which would go back one directory, THEN into the includes subdirectory, and
then it could find dblib.inc

I would definitely add:
 error_reporting(2039);

...to the top of your page.php code to see if you can pick up any errors.
Also, check your error log if you have one (contact your hosting company if
you're not sure).

I would definitely try to solve this the normal way by finding the problem
with the paths rather than trying to screw with your php.ini or httpd.conf
file - otherwise you'll have a script that might not work if you ever have
to move your scripts or copy them to a development server or something.

- Jonathan

-Original Message-
From: Brad Melendy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 7:27 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] include() statement hell!


Thanks Jonathan,
I'm trying to include a file /includes/dblib.inc from /main/page.php.  In
/main/page.php I use include(includes/dblib.inc);.  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/dblib.inc?

dblib.inc has functions that do connections and queries to a mysql database.
Even stranger yet, is that I have one other include file called userlib.inc
that has authentication related session functions.  Well, that hasn't worked
at all no matter what, unless I put the functions in /includes/userlib.inc
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:

include(dblib.inc);
include(userlib.inc);

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:

include(includes/dblib.inc);
include(includes/userlib.inc);

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 userlib.inc 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/dblib.inc
works great.

...Brad




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

Re: [PHP-DB] include() statement hell!

2002-03-28 Thread Brad Melendy

Thanks Jonathan,
Your suggestions were very helpful, especially turning on the error logging.
Here is where I'm at now:

Files in use:
/include/dblib.inc
/include/userlib.inc
/main/page.php

My include statements in /main/page.php:
include(../include/dblib.inc);
include(../include/userlib.inc);

All the fuctions I call from dblib.inc work great, however, I have only a
single function in userlib.inc and it generates an error.  The error I get
is:

Fatal error: Call to undefined function: cleansession()

Here is the file userlib.inc:

php?
session_start();
session_register( session );

function cleanSession( $id, $login, $pass )
 {
 global $session;
 $session[id] = $id;
 $session[login] = $login;
 $session[password] = $pass;
 $session[logged_in] = true;
 }
?

Lastly, if I paste the above function  into page.php (without the
session_start and session_register lines) it works fine.  I've tried giving
the function a different name, changing case, all sorts of stuff.  I've
tried renaming it to userlib.php and I've opened the file directly in my
browser with the error_reporting(2039); at the top and no error messages,
yet it is as if the file never gets included.  I've tried including ONLY
userlib.inc and pasting all the dblib.inc functions into page.php (to rule
out dblib.inc screwing things up) and still I get the error.

I am truly confounded at this point.  Thanks for any suggestions you have.
I think I am almost out of Include Statement Hell.  ;-)

...Brad

Jonathan Hilgeman [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  So, maybe this is the question.  Can you include a file from
  /main/page.php by using a path of /includes/dblib.inc?

 Probably not. PHP can see the whole filesystem, not just the area that
is
 limited to your account. So, when you try to include /includes/dblib.inc
 it is trying to go down to the SYSTEM root and open up a subdirectory
called
 includes and get the file dblib.inc inside it.

 If you copy the dblib.inc to the same directory as page.php, you should
only
 have to say:
  include(dblib.inc);

 However, if you have this layout:
  /your/account/dir/main/page.php
  /your/account/dir/includes/dblib.inc
  /your/account/dir/includes/userlib.inc

 Then page.php would have to say:
  include(../includes/dblib.inc);

 Which would go back one directory, THEN into the includes subdirectory,
and
 then it could find dblib.inc

 I would definitely add:
  error_reporting(2039);

 ...to the top of your page.php code to see if you can pick up any errors.
 Also, check your error log if you have one (contact your hosting company
if
 you're not sure).

 I would definitely try to solve this the normal way by finding the problem
 with the paths rather than trying to screw with your php.ini or httpd.conf
 file - otherwise you'll have a script that might not work if you ever have
 to move your scripts or copy them to a development server or something.

 - Jonathan

 -Original Message-
 From: Brad Melendy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 27, 2002 7:27 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] include() statement hell!


 Thanks Jonathan,
 I'm trying to include a file /includes/dblib.inc from /main/page.php.  In
 /main/page.php I use include(includes/dblib.inc);.  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/dblib.inc?

 dblib.inc has functions that do connections and queries to a mysql
database.
 Even stranger yet, is that I have one other include file called
userlib.inc
 that has authentication related session functions.  Well, that hasn't
worked
 at all no matter what, unless I put the functions in /includes/userlib.inc
 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:

 include(dblib.inc);
 include(userlib.inc);

 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:

 include(includes/dblib.inc);
 include(includes/userlib.inc);

 I get errors saying that the functio

RE: [PHP-DB] include() statement hell!

2002-03-28 Thread Jonathan Hilgeman

This might be your problem:
php?

Try:
?php

:)

- Jonathan

-Original Message-
From: Brad Melendy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 12:06 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] include() statement hell!


Thanks Jonathan,
Your suggestions were very helpful, especially turning on the error logging.
Here is where I'm at now:

Files in use:
/include/dblib.inc
/include/userlib.inc
/main/page.php

My include statements in /main/page.php:
include(../include/dblib.inc);
include(../include/userlib.inc);

All the fuctions I call from dblib.inc work great, however, I have only a
single function in userlib.inc and it generates an error.  The error I get
is:

Fatal error: Call to undefined function: cleansession()

Here is the file userlib.inc:

php?
session_start();
session_register( session );

function cleanSession( $id, $login, $pass )
 {
 global $session;
 $session[id] = $id;
 $session[login] = $login;
 $session[password] = $pass;
 $session[logged_in] = true;
 }
?

Lastly, if I paste the above function  into page.php (without the
session_start and session_register lines) it works fine.  I've tried giving
the function a different name, changing case, all sorts of stuff.  I've
tried renaming it to userlib.php and I've opened the file directly in my
browser with the error_reporting(2039); at the top and no error messages,
yet it is as if the file never gets included.  I've tried including ONLY
userlib.inc and pasting all the dblib.inc functions into page.php (to rule
out dblib.inc screwing things up) and still I get the error.

I am truly confounded at this point.  Thanks for any suggestions you have.
I think I am almost out of Include Statement Hell.  ;-)

...Brad

Jonathan Hilgeman [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  So, maybe this is the question.  Can you include a file from
  /main/page.php by using a path of /includes/dblib.inc?

 Probably not. PHP can see the whole filesystem, not just the area that
is
 limited to your account. So, when you try to include /includes/dblib.inc
 it is trying to go down to the SYSTEM root and open up a subdirectory
called
 includes and get the file dblib.inc inside it.

 If you copy the dblib.inc to the same directory as page.php, you should
only
 have to say:
  include(dblib.inc);

 However, if you have this layout:
  /your/account/dir/main/page.php
  /your/account/dir/includes/dblib.inc
  /your/account/dir/includes/userlib.inc

 Then page.php would have to say:
  include(../includes/dblib.inc);

 Which would go back one directory, THEN into the includes subdirectory,
and
 then it could find dblib.inc

 I would definitely add:
  error_reporting(2039);

 ...to the top of your page.php code to see if you can pick up any errors.
 Also, check your error log if you have one (contact your hosting company
if
 you're not sure).

 I would definitely try to solve this the normal way by finding the problem
 with the paths rather than trying to screw with your php.ini or httpd.conf
 file - otherwise you'll have a script that might not work if you ever have
 to move your scripts or copy them to a development server or something.

 - Jonathan

 -Original Message-
 From: Brad Melendy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 27, 2002 7:27 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] include() statement hell!


 Thanks Jonathan,
 I'm trying to include a file /includes/dblib.inc from /main/page.php.  In
 /main/page.php I use include(includes/dblib.inc);.  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/dblib.inc?

 dblib.inc has functions that do connections and queries to a mysql
database.
 Even stranger yet, is that I have one other include file called
userlib.inc
 that has authentication related session functions.  Well, that hasn't
worked
 at all no matter what, unless I put the functions in /includes/userlib.inc
 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:

 include(dblib.inc);
 include(userlib.inc);

 They are both located in /main/ al

RE: [PHP-DB] include() statement hell!

2002-03-28 Thread Jonathan Hilgeman

You should also put quotes around your keys in your arrays if they're
non-numeric. For instance:
$session[logged_in] instead of $session[logged_in]

It's good coding habit, and it sometimes will save you from some constant
headaches (pun intended for everyone who has run into this problem before).

- Jonathan



-Original Message-
From: Brad Melendy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 12:06 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] include() statement hell!


Thanks Jonathan,
Your suggestions were very helpful, especially turning on the error logging.
Here is where I'm at now:

Files in use:
/include/dblib.inc
/include/userlib.inc
/main/page.php

My include statements in /main/page.php:
include(../include/dblib.inc);
include(../include/userlib.inc);

All the fuctions I call from dblib.inc work great, however, I have only a
single function in userlib.inc and it generates an error.  The error I get
is:

Fatal error: Call to undefined function: cleansession()

Here is the file userlib.inc:

php?
session_start();
session_register( session );

function cleanSession( $id, $login, $pass )
 {
 global $session;
 $session[id] = $id;
 $session[login] = $login;
 $session[password] = $pass;
 $session[logged_in] = true;
 }
?

Lastly, if I paste the above function  into page.php (without the
session_start and session_register lines) it works fine.  I've tried giving
the function a different name, changing case, all sorts of stuff.  I've
tried renaming it to userlib.php and I've opened the file directly in my
browser with the error_reporting(2039); at the top and no error messages,
yet it is as if the file never gets included.  I've tried including ONLY
userlib.inc and pasting all the dblib.inc functions into page.php (to rule
out dblib.inc screwing things up) and still I get the error.

I am truly confounded at this point.  Thanks for any suggestions you have.
I think I am almost out of Include Statement Hell.  ;-)

...Brad

Jonathan Hilgeman [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  So, maybe this is the question.  Can you include a file from
  /main/page.php by using a path of /includes/dblib.inc?

 Probably not. PHP can see the whole filesystem, not just the area that
is
 limited to your account. So, when you try to include /includes/dblib.inc
 it is trying to go down to the SYSTEM root and open up a subdirectory
called
 includes and get the file dblib.inc inside it.

 If you copy the dblib.inc to the same directory as page.php, you should
only
 have to say:
  include(dblib.inc);

 However, if you have this layout:
  /your/account/dir/main/page.php
  /your/account/dir/includes/dblib.inc
  /your/account/dir/includes/userlib.inc

 Then page.php would have to say:
  include(../includes/dblib.inc);

 Which would go back one directory, THEN into the includes subdirectory,
and
 then it could find dblib.inc

 I would definitely add:
  error_reporting(2039);

 ...to the top of your page.php code to see if you can pick up any errors.
 Also, check your error log if you have one (contact your hosting company
if
 you're not sure).

 I would definitely try to solve this the normal way by finding the problem
 with the paths rather than trying to screw with your php.ini or httpd.conf
 file - otherwise you'll have a script that might not work if you ever have
 to move your scripts or copy them to a development server or something.

 - Jonathan

 -Original Message-
 From: Brad Melendy [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 27, 2002 7:27 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] include() statement hell!


 Thanks Jonathan,
 I'm trying to include a file /includes/dblib.inc from /main/page.php.  In
 /main/page.php I use include(includes/dblib.inc);.  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/dblib.inc?

 dblib.inc has functions that do connections and queries to a mysql
database.
 Even stranger yet, is that I have one other include file called
userlib.inc
 that has authentication related session functions.  Well, that hasn't
worked
 at all no matter what, unless I put the functions in /includes/userlib.inc
 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

Re: [PHP-DB] include() statement hell!

2002-03-28 Thread Brad Melendy

Man, this means I have to walk around the block with a sign on my back
saying, I'm a %*$-ASS for letting that one get by.  ;-)  Thanks a ton
Jonathan.  It of course, works now.  I think it will be a while before I
make that mistake again.

...Brad

Jonathan Hilgeman [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 This might be your problem:
 php?

 Try:
 ?php

 :)

 - Jonathan

 -Original Message-
 From: Brad Melendy [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 28, 2002 12:06 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] include() statement hell!


 Thanks Jonathan,
 Your suggestions were very helpful, especially turning on the error
logging.
 Here is where I'm at now:

 Files in use:
 /include/dblib.inc
 /include/userlib.inc
 /main/page.php

 My include statements in /main/page.php:
 include(../include/dblib.inc);
 include(../include/userlib.inc);

 All the fuctions I call from dblib.inc work great, however, I have only a
 single function in userlib.inc and it generates an error.  The error I get
 is:

 Fatal error: Call to undefined function: cleansession()

 Here is the file userlib.inc:

 php?
 session_start();
 session_register( session );

 function cleanSession( $id, $login, $pass )
  {
  global $session;
  $session[id] = $id;
  $session[login] = $login;
  $session[password] = $pass;
  $session[logged_in] = true;
  }
 ?

 Lastly, if I paste the above function  into page.php (without the
 session_start and session_register lines) it works fine.  I've tried
giving
 the function a different name, changing case, all sorts of stuff.  I've
 tried renaming it to userlib.php and I've opened the file directly in my
 browser with the error_reporting(2039); at the top and no error messages,
 yet it is as if the file never gets included.  I've tried including ONLY
 userlib.inc and pasting all the dblib.inc functions into page.php (to rule
 out dblib.inc screwing things up) and still I get the error.

 I am truly confounded at this point.  Thanks for any suggestions you have.
 I think I am almost out of Include Statement Hell.  ;-)

 ...Brad

 Jonathan Hilgeman [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   So, maybe this is the question.  Can you include a file from
   /main/page.php by using a path of /includes/dblib.inc?
 
  Probably not. PHP can see the whole filesystem, not just the area that
 is
  limited to your account. So, when you try to include
/includes/dblib.inc
  it is trying to go down to the SYSTEM root and open up a subdirectory
 called
  includes and get the file dblib.inc inside it.
 
  If you copy the dblib.inc to the same directory as page.php, you should
 only
  have to say:
   include(dblib.inc);
 
  However, if you have this layout:
   /your/account/dir/main/page.php
   /your/account/dir/includes/dblib.inc
   /your/account/dir/includes/userlib.inc
 
  Then page.php would have to say:
   include(../includes/dblib.inc);
 
  Which would go back one directory, THEN into the includes subdirectory,
 and
  then it could find dblib.inc
 
  I would definitely add:
   error_reporting(2039);
 
  ...to the top of your page.php code to see if you can pick up any
errors.
  Also, check your error log if you have one (contact your hosting company
 if
  you're not sure).
 
  I would definitely try to solve this the normal way by finding the
problem
  with the paths rather than trying to screw with your php.ini or
httpd.conf
  file - otherwise you'll have a script that might not work if you ever
have
  to move your scripts or copy them to a development server or something.
 
  - Jonathan
 
  -Original Message-
  From: Brad Melendy [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, March 27, 2002 7:27 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] include() statement hell!
 
 
  Thanks Jonathan,
  I'm trying to include a file /includes/dblib.inc from /main/page.php.
In
  /main/page.php I use include(includes/dblib.inc);.  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/dblib.inc?
 
  dblib.inc has functions that do connections and queries to a mysql
 database.
  Even stranger yet, is that I have one other include file called
 userlib.inc
  that has authentication related session functions.  Well, that hasn't
 worked
  at all no matter wh

RE: [PHP-DB] include() statement hell!

2002-03-28 Thread Jonathan Hilgeman

No problem. I wonder if there's a web-based syntax checker for PHP...

- Jonathan

-Original Message-
From: Brad Melendy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 28, 2002 12:23 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] include() statement hell!


Man, this means I have to walk around the block with a sign on my back
saying, I'm a %*$-ASS for letting that one get by.  ;-)  Thanks a ton
Jonathan.  It of course, works now.  I think it will be a while before I
make that mistake again.

...Brad

Jonathan Hilgeman [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 This might be your problem:
 php?

 Try:
 ?php

 :)

 - Jonathan

 -Original Message-
 From: Brad Melendy [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 28, 2002 12:06 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] include() statement hell!


 Thanks Jonathan,
 Your suggestions were very helpful, especially turning on the error
logging.
 Here is where I'm at now:

 Files in use:
 /include/dblib.inc
 /include/userlib.inc
 /main/page.php

 My include statements in /main/page.php:
 include(../include/dblib.inc);
 include(../include/userlib.inc);

 All the fuctions I call from dblib.inc work great, however, I have only a
 single function in userlib.inc and it generates an error.  The error I get
 is:

 Fatal error: Call to undefined function: cleansession()

 Here is the file userlib.inc:

 php?
 session_start();
 session_register( session );

 function cleanSession( $id, $login, $pass )
  {
  global $session;
  $session[id] = $id;
  $session[login] = $login;
  $session[password] = $pass;
  $session[logged_in] = true;
  }
 ?

 Lastly, if I paste the above function  into page.php (without the
 session_start and session_register lines) it works fine.  I've tried
giving
 the function a different name, changing case, all sorts of stuff.  I've
 tried renaming it to userlib.php and I've opened the file directly in my
 browser with the error_reporting(2039); at the top and no error messages,
 yet it is as if the file never gets included.  I've tried including ONLY
 userlib.inc and pasting all the dblib.inc functions into page.php (to rule
 out dblib.inc screwing things up) and still I get the error.

 I am truly confounded at this point.  Thanks for any suggestions you have.
 I think I am almost out of Include Statement Hell.  ;-)

 ...Brad

 Jonathan Hilgeman [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   So, maybe this is the question.  Can you include a file from
   /main/page.php by using a path of /includes/dblib.inc?
 
  Probably not. PHP can see the whole filesystem, not just the area that
 is
  limited to your account. So, when you try to include
/includes/dblib.inc
  it is trying to go down to the SYSTEM root and open up a subdirectory
 called
  includes and get the file dblib.inc inside it.
 
  If you copy the dblib.inc to the same directory as page.php, you should
 only
  have to say:
   include(dblib.inc);
 
  However, if you have this layout:
   /your/account/dir/main/page.php
   /your/account/dir/includes/dblib.inc
   /your/account/dir/includes/userlib.inc
 
  Then page.php would have to say:
   include(../includes/dblib.inc);
 
  Which would go back one directory, THEN into the includes subdirectory,
 and
  then it could find dblib.inc
 
  I would definitely add:
   error_reporting(2039);
 
  ...to the top of your page.php code to see if you can pick up any
errors.
  Also, check your error log if you have one (contact your hosting company
 if
  you're not sure).
 
  I would definitely try to solve this the normal way by finding the
problem
  with the paths rather than trying to screw with your php.ini or
httpd.conf
  file - otherwise you'll have a script that might not work if you ever
have
  to move your scripts or copy them to a development server or something.
 
  - Jonathan
 
  -Original Message-
  From: Brad Melendy [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, March 27, 2002 7:27 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] include() statement hell!
 
 
  Thanks Jonathan,
  I'm trying to include a file /includes/dblib.inc from /main/page.php.
In
  /main/page.php I use include(includes/dblib.inc);.  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/dblib.in

Re: [PHP-DB] include() statement hell!

2002-03-28 Thread Brad Melendy

I'll do that Jonathan.  I want to thank you again, and everyone else that
gave me suggestions.  I think I finally understand all the 'rules' about the
include statement AND that I've got to keep a close eye on my typos.  Thanks
once again!

...Brad :-)

Jonathan Hilgeman [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You should also put quotes around your keys in your arrays if they're
 non-numeric. For instance:
 $session[logged_in] instead of $session[logged_in]

 It's good coding habit, and it sometimes will save you from some
constant
 headaches (pun intended for everyone who has run into this problem
before).

 - Jonathan



 -Original Message-
 From: Brad Melendy [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 28, 2002 12:06 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] include() statement hell!


 Thanks Jonathan,
 Your suggestions were very helpful, especially turning on the error
logging.
 Here is where I'm at now:

 Files in use:
 /include/dblib.inc
 /include/userlib.inc
 /main/page.php

 My include statements in /main/page.php:
 include(../include/dblib.inc);
 include(../include/userlib.inc);

 All the fuctions I call from dblib.inc work great, however, I have only a
 single function in userlib.inc and it generates an error.  The error I get
 is:

 Fatal error: Call to undefined function: cleansession()

 Here is the file userlib.inc:

 php?
 session_start();
 session_register( session );

 function cleanSession( $id, $login, $pass )
  {
  global $session;
  $session[id] = $id;
  $session[login] = $login;
  $session[password] = $pass;
  $session[logged_in] = true;
  }
 ?

 Lastly, if I paste the above function  into page.php (without the
 session_start and session_register lines) it works fine.  I've tried
giving
 the function a different name, changing case, all sorts of stuff.  I've
 tried renaming it to userlib.php and I've opened the file directly in my
 browser with the error_reporting(2039); at the top and no error messages,
 yet it is as if the file never gets included.  I've tried including ONLY
 userlib.inc and pasting all the dblib.inc functions into page.php (to rule
 out dblib.inc screwing things up) and still I get the error.

 I am truly confounded at this point.  Thanks for any suggestions you have.
 I think I am almost out of Include Statement Hell.  ;-)

 ...Brad

 Jonathan Hilgeman [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   So, maybe this is the question.  Can you include a file from
   /main/page.php by using a path of /includes/dblib.inc?
 
  Probably not. PHP can see the whole filesystem, not just the area that
 is
  limited to your account. So, when you try to include
/includes/dblib.inc
  it is trying to go down to the SYSTEM root and open up a subdirectory
 called
  includes and get the file dblib.inc inside it.
 
  If you copy the dblib.inc to the same directory as page.php, you should
 only
  have to say:
   include(dblib.inc);
 
  However, if you have this layout:
   /your/account/dir/main/page.php
   /your/account/dir/includes/dblib.inc
   /your/account/dir/includes/userlib.inc
 
  Then page.php would have to say:
   include(../includes/dblib.inc);
 
  Which would go back one directory, THEN into the includes subdirectory,
 and
  then it could find dblib.inc
 
  I would definitely add:
   error_reporting(2039);
 
  ...to the top of your page.php code to see if you can pick up any
errors.
  Also, check your error log if you have one (contact your hosting company
 if
  you're not sure).
 
  I would definitely try to solve this the normal way by finding the
problem
  with the paths rather than trying to screw with your php.ini or
httpd.conf
  file - otherwise you'll have a script that might not work if you ever
have
  to move your scripts or copy them to a development server or something.
 
  - Jonathan
 
  -Original Message-
  From: Brad Melendy [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, March 27, 2002 7:27 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] include() statement hell!
 
 
  Thanks Jonathan,
  I'm trying to include a file /includes/dblib.inc from /main/page.php.
In
  /main/page.php I use include(includes/dblib.inc);.  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/dblib.inc?
 

RE: [PHP-DB] include() statement hell!

2002-03-27 Thread Rick Emery

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
To: [EMAIL PROTECTED]
Subject: [PHP-DB] include() statement hell!


Ok, I've spent some time reading the docs at php.net and I'm still confused.

After a couple hours, I have an include file working with a statement like:

include (dblib.inc);

However, to add to my confusion, I've got a second include file statement on
the next line:

include (userlib.inc);

And that doesn't work.

Most crazy of all, if I just put the darn functions all in the PHP file that
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 since
I'm just using include files that exist in the same directory as the calling
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 work.
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 ideas
why this is so difficult for me?  What am I missing?  This stuff is easy in
ASP but PHP is giving me serious heart-ache.  :-(

Thanks for any tips or suggestions.

Brad



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

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




RE: [PHP-DB] include() statement hell!

2002-03-27 Thread Jonathan Hilgeman

#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 www.domain.com/page.php which calls
www.domain.com/includes/header.inc.
Then, header.inc includes the dblib.inc file at
www.domain.com/includes/dblib.inc. However, the include's base directory
will still be in page.php - the directory won't change to includes, so for
header.inc to include dblib.inc, it has to say:
  include(includes/dblib.inc);
NOT
  include(dblib.inc);
Otherwise, it will be trying to include www.domain.com/dblib.inc because the
page that started the whole chain reaction of includes is located at
www.domain.com/page.php

#2. If you have error reporting turned off, and there is a parsing error in
your files, the page may just die without giving a reason. Try turning off
any error reporting and also access those include files like userlib.inc
directly in your web browser to see if PHP reports any errors. You may need
to change the extension to something like userlib.inc.php for the web server
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
To: [EMAIL PROTECTED]
Subject: [PHP-DB] include() statement hell!


Ok, I've spent some time reading the docs at php.net and I'm still confused.

After a couple hours, I have an include file working with a statement like:

include (dblib.inc);

However, to add to my confusion, I've got a second include file statement on
the next line:

include (userlib.inc);

And that doesn't work.

Most crazy of all, if I just put the darn functions all in the PHP file that
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 since
I'm just using include files that exist in the same directory as the calling
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 work.
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 ideas
why this is so difficult for me?  What am I missing?  This stuff is easy in
ASP but PHP is giving me serious heart-ache.  :-(

Thanks for any tips or suggestions.

Brad



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

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

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




Re: [PHP-DB] include() statement hell!

2002-03-27 Thread Brad Melendy

Hi Rick,
Yes, this is the first thing I checked.  Thanks for your suggestion.

...Brad

Rick Emery [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 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
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] include() statement hell!


 Ok, I've spent some time reading the docs at php.net and I'm still
confused.

 After a couple hours, I have an include file working with a statement
like:

 include (dblib.inc);

 However, to add to my confusion, I've got a second include file statement
on
 the next line:

 include (userlib.inc);

 And that doesn't work.

 Most crazy of all, if I just put the darn functions all in the PHP file
that
 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
since
 I'm just using include files that exist in the same directory as the
calling
 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
work.
 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
ideas
 why this is so difficult for me?  What am I missing?  This stuff is easy
in
 ASP but PHP is giving me serious heart-ache.  :-(

 Thanks for any tips or suggestions.

 Brad



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



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




Re: [PHP-DB] include() statement hell!

2002-03-27 Thread Brad Melendy

Thanks Jonathan,
I'm trying to include a file /includes/dblib.inc from /main/page.php.  In
/main/page.php I use include(includes/dblib.inc);.  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/dblib.inc?

dblib.inc has functions that do connections and queries to a mysql database.
Even stranger yet, is that I have one other include file called userlib.inc
that has authentication related session functions.  Well, that hasn't worked
at all no matter what, unless I put the functions in /includes/userlib.inc
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:

include(dblib.inc);
include(userlib.inc);

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:

include(includes/dblib.inc);
include(includes/userlib.inc);

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 userlib.inc 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/dblib.inc
works great.

...Brad



Jonathan Hilgeman [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 #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 www.domain.com/page.php which calls
 www.domain.com/includes/header.inc.
 Then, header.inc includes the dblib.inc file at
 www.domain.com/includes/dblib.inc. However, the include's base directory
 will still be in page.php - the directory won't change to includes, so for
 header.inc to include dblib.inc, it has to say:
   include(includes/dblib.inc);
 NOT
   include(dblib.inc);
 Otherwise, it will be trying to include www.domain.com/dblib.inc because
the
 page that started the whole chain reaction of includes is located at
 www.domain.com/page.php

 #2. If you have error reporting turned off, and there is a parsing error
in
 your files, the page may just die without giving a reason. Try turning off
 any error reporting and also access those include files like userlib.inc
 directly in your web browser to see if PHP reports any errors. You may
need
 to change the extension to something like userlib.inc.php for the web
server
 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
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] include() statement hell!


 Ok, I've spent some time reading the docs at php.net and I'm still
confused.

 After a couple hours, I have an include file working with a statement
like:

 include (dblib.inc);

 However, to add to my confusion, I've got a second include file statement
on
 the next line:

 include (userlib.inc);

 And that doesn't work.

 Most crazy of all, if I just put the darn functions all in the PHP file
that
 is trying to call the include files, everythi

RE: [PHP-DB] include() statement hell!

2002-03-27 Thread Dan Brunner

Has anybody told him to check his PHP.INI???

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 27, 2002 6:28 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] include() statement hell!

#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 www.domain.com/page.php which calls
www.domain.com/includes/header.inc.
Then, header.inc includes the dblib.inc file at
www.domain.com/includes/dblib.inc. However, the include's base directory
will still be in page.php - the directory won't change to includes, so
for
header.inc to include dblib.inc, it has to say:
  include(includes/dblib.inc);
NOT
  include(dblib.inc);
Otherwise, it will be trying to include www.domain.com/dblib.inc because
the
page that started the whole chain reaction of includes is located at
www.domain.com/page.php

#2. If you have error reporting turned off, and there is a parsing error
in
your files, the page may just die without giving a reason. Try turning
off
any error reporting and also access those include files like userlib.inc
directly in your web browser to see if PHP reports any errors. You may
need
to change the extension to something like userlib.inc.php for the web
server
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
To: [EMAIL PROTECTED]
Subject: [PHP-DB] include() statement hell!


Ok, I've spent some time reading the docs at php.net and I'm still
confused.

After a couple hours, I have an include file working with a statement
like:

include (dblib.inc);

However, to add to my confusion, I've got a second include file
statement on
the next line:

include (userlib.inc);

And that doesn't work.

Most crazy of all, if I just put the darn functions all in the PHP file
that
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
since
I'm just using include files that exist in the same directory as the
calling
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
work.
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
ideas
why this is so difficult for me?  What am I missing?  This stuff is easy
in
ASP but PHP is giving me serious heart-ache.  :-(

Thanks for any tips or suggestions.

Brad



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

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

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



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




RE: [PHP-DB] include() statement hell!

2002-03-27 Thread Photocon

At 22:41 3/27/2002 -0600, Dan Brunner wrote:
Has anybody told him to check his PHP.INI???

How about adding the following to httpd.conf:

php_value include_path .:/usr/share/php:/path/to/webpages


--Photocon
Conrad Hunziker III
www.nightskyent.com


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




Re: [PHP-DB] include() statement hell!

2002-03-27 Thread Brad Melendy

The thing that sucks about having to rely upon the php.ini file is that the
you must use a particular folder for all your include files, even if you are
using files for several different sites.  It makes much more sense to be
able to put your include files for a particular site in that site.  It's
easier for backups, moving the site and for shared hosting.  I've gotten it
to work partially using the folder defined in the php.ini file, but I want
to be able to specifiy a folder from within the calling php file, which is
how you should be able to do it.

...Brad


Dan Brunner [EMAIL PROTECTED] wrote in message
01c1d612$e94f0570$b3f7a718@doggy">news:01c1d612$e94f0570$b3f7a718@doggy...
 Has anybody told him to check his PHP.INI???

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 27, 2002 6:28 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] include() statement hell!

 #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 www.domain.com/page.php which calls
 www.domain.com/includes/header.inc.
 Then, header.inc includes the dblib.inc file at
 www.domain.com/includes/dblib.inc. However, the include's base directory
 will still be in page.php - the directory won't change to includes, so
 for
 header.inc to include dblib.inc, it has to say:
   include(includes/dblib.inc);
 NOT
   include(dblib.inc);
 Otherwise, it will be trying to include www.domain.com/dblib.inc because
 the
 page that started the whole chain reaction of includes is located at
 www.domain.com/page.php

 #2. If you have error reporting turned off, and there is a parsing error
 in
 your files, the page may just die without giving a reason. Try turning
 off
 any error reporting and also access those include files like userlib.inc
 directly in your web browser to see if PHP reports any errors. You may
 need
 to change the extension to something like userlib.inc.php for the web
 server
 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
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] include() statement hell!


 Ok, I've spent some time reading the docs at php.net and I'm still
 confused.

 After a couple hours, I have an include file working with a statement
 like:

 include (dblib.inc);

 However, to add to my confusion, I've got a second include file
 statement on
 the next line:

 include (userlib.inc);

 And that doesn't work.

 Most crazy of all, if I just put the darn functions all in the PHP file
 that
 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
 since
 I'm just using include files that exist in the same directory as the
 calling
 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
 work.
 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
 ideas
 why this is so difficult for me?  What am I missing?  This stuff is easy
 in
 ASP but PHP is giving me serious heart-ache.  :-(

 Thanks for any tips or suggestions.

 Brad



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

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

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





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




Re: [PHP-DB] include() statement hell!

2002-03-27 Thread Jason Wong

On Thursday 28 March 2002 14:58, Brad Melendy wrote:
 How is this different than using the php.ini file?

 Photocon [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

  At 22:41 3/27/2002 -0600, Dan Brunner wrote:
  Has anybody told him to check his PHP.INI???
 
  How about adding the following to httpd.conf:
 
  php_value include_path .:/usr/share/php:/path/to/webpages

Because you can have per-site settings which are different from those of 
php.ini.


Also you can have per-file settings by using the ini_set() function. If 
you're not able to change the httpd.conf file then just use ini_set() at the 
beginning of all your php files to specify an include path.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Support wildlife -- vote for an orgy.
*/

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