Re: [PHP] Problems with includes

2008-05-16 Thread Dan Joseph
On Fri, May 16, 2008 at 2:25 PM, Tyson Vanover [EMAIL PROTECTED] wrote:

 I am trying to keep my tools and pages segregated for a variety of reasons
 (organization, security, etc).  And I am having problems with my includes on
 my LAMP box.  My user facing tools are not including my utility classes and
 files.

 The root directory of my web server (www.hostname.com/) is:
 /srv/www/html/

 My utility classes and files that need to be included by many of my user
 tools are in subdirectories of:
 /srv/www/html/Tools
 ie
 /srv/www/html/Tools/tool1/tool1.php
 /srv/www/html/Tools/tool2/tool2.php
 included in these sub directories are tool testing pages
 (toolname-test.php) and other includes.  As long as the file that is
 including other files is in the same directory as the files it is including,
 it works just fine.

 My user tools each have their own subdirectories off the webserver root
 /srv/www/html/
 ie
 /srv/www/html/library/index.php


 So I would think that to include my utility files into my user tools I
 would start the file with something like this:

 require /Tools/tool1/tool1.php;
 require /Tools/tool2/tool2.php;

 But when I do I get:
 require(/Tools/dbtools/dbtool.php) [function.require]: failed to open
 stream: No such file or directory  /srv/www/html/lib/index.php, line 16

 require() [function.require]: Failed opening required
 '/Tools/dbtools/dbtool.php' (include_path='.:/usr/share/pear')
 /srv/www/html/lib/index.php, line 16

 Am I missing something?

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


I'm pretty sure you're gonna need to include the entire path:

require( /srv/www/html/Tools/tool2/tool2.php );

for both of your tools.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month. Reseller plans and
Dedicated servers available.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] Problems with includes

2008-05-16 Thread Jim Lucas

Tyson Vanover wrote:
I am trying to keep my tools and pages segregated for a variety of 
reasons (organization, security, etc).  And I am having problems with my 
includes on my LAMP box.  My user facing tools are not including my 
utility classes and files.


The root directory of my web server (www.hostname.com/) is:
/srv/www/html/

My utility classes and files that need to be included by many of my user 
tools are in subdirectories of:

/srv/www/html/Tools
ie
/srv/www/html/Tools/tool1/tool1.php
/srv/www/html/Tools/tool2/tool2.php
included in these sub directories are tool testing pages 
(toolname-test.php) and other includes.  As long as the file that is 
including other files is in the same directory as the files it is 
including, it works just fine.


My user tools each have their own subdirectories off the webserver root
/srv/www/html/
ie
/srv/www/html/library/index.php


So I would think that to include my utility files into my user tools I 
would start the file with something like this:


require /Tools/tool1/tool1.php;
require /Tools/tool2/tool2.php;

But when I do I get:
require(/Tools/dbtools/dbtool.php) [function.require]: failed to open 
stream: No such file or directory  /srv/www/html/lib/index.php, line 16


require() [function.require]: Failed opening required 
'/Tools/dbtools/dbtool.php' (include_path='.:/usr/share/pear') 
/srv/www/html/lib/index.php, line 16


Am I missing something?



Their are two ways that come to mind.

1. Like Dan suggested, use the full path.

2. (I prefer this way), change your include_path setting either in your php.ini 
file, virtual host, .htaccess or in your script to include the base path for 
your web site /srv/www/html/ and then you can call them by simply removing the 
leading slash from your existing calls.

require 'Tools/tool1/tool1.php';
require 'Tools/tool2/tool2.php';

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] Problems with includes

2008-05-16 Thread Tyson Vanover

Dan Joseph wrote:


I'm pretty sure you're gonna need to include the entire path:

require( /srv/www/html/Tools/tool2/tool2.php );

for both of your tools.



So when php runs it's paths are drawn from the OS's 
structure and not apache's?  hun.  thanks!


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



Re: [PHP] Problems with includes

2008-05-16 Thread Tyson Vanover

Jim Lucas wrote:


Their are two ways that come to mind.

1. Like Dan suggested, use the full path.

2. (I prefer this way), change your include_path setting either in your 
php.ini file, virtual host, .htaccess or in your script to include the 
base path for your web site /srv/www/html/ and then you can call them 
by simply removing the leading slash from your existing calls.

require 'Tools/tool1/tool1.php';
require 'Tools/tool2/tool2.php';



So in say, php.ini, I set the include path to something 
like:


include_path = .:/php/includes:/srv/www/html

Will pointing it at /srv/www/html open up any 
security holes?


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



Re: [PHP] Problems with includes

2008-05-16 Thread Jim Lucas

Tyson Vanover wrote:

Dan Joseph wrote:


I'm pretty sure you're gonna need to include the entire path:

require( /srv/www/html/Tools/tool2/tool2.php );

for both of your tools.



So when php runs it's paths are drawn from the OS's structure and not 
apache's?  hun.  thanks!




Only if apache is run chroot'ed

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] Problems with includes

2008-05-16 Thread Jim Lucas

Tyson Vanover wrote:

Jim Lucas wrote:


Their are two ways that come to mind.

1. Like Dan suggested, use the full path.

2. (I prefer this way), change your include_path setting either in 
your php.ini file, virtual host, .htaccess or in your script to 
include the base path for your web site /srv/www/html/ and then you 
can call them by simply removing the leading slash from your existing 
calls.

require 'Tools/tool1/tool1.php';
require 'Tools/tool2/tool2.php';



So in say, php.ini, I set the include path to something like:

include_path = .:/php/includes:/srv/www/html

Will pointing it at /srv/www/html open up any security holes?



None that I am aware of.  Doing it in the php.ini file will make it available to 
any host that you have that uses php.  Just be aware of that fact.


--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] Problems with includes

2008-05-16 Thread Andrew Ballard
On Fri, May 16, 2008 at 3:31 PM, Tyson Vanover [EMAIL PROTECTED] wrote:
 Dan Joseph wrote:

 I'm pretty sure you're gonna need to include the entire path:

 require( /srv/www/html/Tools/tool2/tool2.php );

 for both of your tools.


 So when php runs it's paths are drawn from the OS's structure and not
 apache's?  hun.  thanks!


No, RTM.

Files for including are first looked for in each include_path entry
relative to the current working directory, and then in the directory
of current script.

http://www.php.net/manual/en/function.include.php


Andrew

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



Re: [PHP] Problems with includes

2008-05-16 Thread Dan Joseph
On Fri, May 16, 2008 at 3:41 PM, Jim Lucas [EMAIL PROTECTED] wrote:

 Tyson Vanover wrote:

 Jim Lucas wrote:

  Their are two ways that come to mind.

 1. Like Dan suggested, use the full path.

 2. (I prefer this way), change your include_path setting either in your
 php.ini file, virtual host, .htaccess or in your script to include the base
 path for your web site /srv/www/html/ and then you can call them by simply
 removing the leading slash from your existing calls.
require 'Tools/tool1/tool1.php';
require 'Tools/tool2/tool2.php';


 So in say, php.ini, I set the include path to something like:

 include_path = .:/php/includes:/srv/www/html

 Will pointing it at /srv/www/html open up any security holes?


 None that I am aware of.  Doing it in the php.ini file will make it
 available to any host that you have that uses php.  Just be aware of that
 fact.

 --
 Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

 Twelfth Night, Act II, Scene V
by William Shakespeare


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


I agree, I wouldn't see how their would be any logically.  Technically, your
docroot is already accessible.  Its how you secure it that matters.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month. Reseller plans and
Dedicated servers available.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] Problems with includes

2008-05-16 Thread Tyson Vanover

Jim Lucas wrote:

Their are two ways that come to mind.

1. Like Dan suggested, use the full path.

2. (I prefer this way), change your include_path setting either in your 
php.ini file, virtual host, .htaccess or in your script to include the 
base path for your web site /srv/www/html/ and then you can call them 
by simply removing the leading slash from your existing calls.

require 'Tools/tool1/tool1.php';
require 'Tools/tool2/tool2.php';



Ok, I have changed my php.ini and restarted apache.  My 
include_path is set to


include_path = .:/srv/www/html

but when I try from /srv/www/html/library/index.php:
require '/Tools/dbtools/dbtool.php';
or
require 'Tools/dbtools/dbtool.php';
or
require '../Tools/dbtools/dbtool.php';

I get the error:
require(/Tools/dbtools/dbtool.php) [function.require]: 
failed to open stream: No such file or directory 
/srv/www/html/lib/index.php, line 10


require() [function.require]: Failed opening required 
'/Tools/dbtools/dbtool.php' 
(include_path='.:/srv/www/html') 
/srv/www/html/lib/index.php, line 10


any thoughts?  Am I missing something obvious?

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



Re: [PHP] Problems with includes

2008-05-16 Thread Dan Joseph
On Fri, May 16, 2008 at 4:36 PM, Tyson Vanover [EMAIL PROTECTED] wrote:

 Jim Lucas wrote:

 Their are two ways that come to mind.

 1. Like Dan suggested, use the full path.

 2. (I prefer this way), change your include_path setting either in your
 php.ini file, virtual host, .htaccess or in your script to include the base
 path for your web site /srv/www/html/ and then you can call them by simply
 removing the leading slash from your existing calls.
require 'Tools/tool1/tool1.php';
require 'Tools/tool2/tool2.php';


 Ok, I have changed my php.ini and restarted apache.  My include_path is set
 to

 include_path = .:/srv/www/html

 but when I try from /srv/www/html/library/index.php:
 require '/Tools/dbtools/dbtool.php';
 or
 require 'Tools/dbtools/dbtool.php';
 or
 require '../Tools/dbtools/dbtool.php';

 I get the error:
 require(/Tools/dbtools/dbtool.php) [function.require]: failed to open
 stream: No such file or directory /srv/www/html/lib/index.php, line 10

 require() [function.require]: Failed opening required
 '/Tools/dbtools/dbtool.php' (include_path='.:/srv/www/html')
 /srv/www/html/lib/index.php, line 10

 any thoughts?  Am I missing something obvious?


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


It deosn't look like it updated your path.  Output a phpinfo() and make sure
you have the correct php.ini.  web servers tend to have more than one laying
around.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month. Reseller plans and
Dedicated servers available.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] Problems with includes

2008-05-16 Thread Jim Lucas

Tyson Vanover wrote:

Jim Lucas wrote:

Their are two ways that come to mind.

1. Like Dan suggested, use the full path.

2. (I prefer this way), change your include_path setting either in 
your php.ini file, virtual host, .htaccess or in your script to 
include the base path for your web site /srv/www/html/ and then you 
can call them by simply removing the leading slash from your existing 
calls.

require 'Tools/tool1/tool1.php';
require 'Tools/tool2/tool2.php';



Ok, I have changed my php.ini and restarted apache.  My include_path is 
set to


include_path = .:/srv/www/html

but when I try from /srv/www/html/library/index.php:
require '/Tools/dbtools/dbtool.php';
or
require 'Tools/dbtools/dbtool.php';
or
require '../Tools/dbtools/dbtool.php';

I get the error:
require(/Tools/dbtools/dbtool.php) [function.require]: failed to open 
stream: No such file or directory /srv/www/html/lib/index.php, line 10


require() [function.require]: Failed opening required 
'/Tools/dbtools/dbtool.php' (include_path='.:/srv/www/html') 
/srv/www/html/lib/index.php, line 10


any thoughts?  Am I missing something obvious?



Possibly that apache is chroot'ed.

I know you said LAMP.  But which OS/etc...

Sometimes you can see from the cli if httpd is rooted.

run 'ps aux | grep httpd' and see if httpd says anything about chroot

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] Problems with includes

2008-05-16 Thread Tyson Vanover

Dan Joseph wrote:

Ok, I have changed my php.ini and restarted apache.  My include_path is set
to

include_path = .:/srv/www/html

but when I try from /srv/www/html/library/index.php:
require '/Tools/dbtools/dbtool.php';
or
require 'Tools/dbtools/dbtool.php';
or
require '../Tools/dbtools/dbtool.php';

I get the error:
require(/Tools/dbtools/dbtool.php) [function.require]: failed to open
stream: No such file or directory /srv/www/html/lib/index.php, line 10

require() [function.require]: Failed opening required
'/Tools/dbtools/dbtool.php' (include_path='.:/srv/www/html')
/srv/www/html/lib/index.php, line 10

any thoughts?  Am I missing something obvious?



It deosn't look like it updated your path.  Output a phpinfo() and make sure
you have the correct php.ini.  web servers tend to have more than one laying
around.


According to phpinfo() I am working with the correct 
php.ini (/etc/php5/php.ini).  And looking in the 
Configuration : PHP Core section doc_root is set to 
/srv/www/html and include_path is set to 
.:/srv/www/html.


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



Re: [PHP] Problems with includes

2008-05-16 Thread Tyson Vanover

Jim Lucas wrote:
  Possibly that apache is chroot'ed.


I know you said LAMP.  But which OS/etc...

Sometimes you can see from the cli if httpd is rooted.

run 'ps aux | grep httpd' and see if httpd says anything about chroot



I don't see anything here

root  1937  0.0  5.2  25600 13456 ?Ss 
19:50   0:00 /usr/sbin/httpd
raa-web   1956  0.3  0.8   4636  2084 ?S 
19:50   0:14 /usr/sbin/lighttpd -f /etc/raa/lighttpd.conf
apache1987  0.0  4.2  25736 10920 ?S 
19:50   0:00 /usr/sbin/httpd
apache1990  0.0  4.2  25736 10892 ?S 
19:50   0:00 /usr/sbin/httpd
apache1993  0.0  4.3  25736 11048 ?S 
19:50   0:00 /usr/sbin/httpd
apache1995  0.0  4.2  25736 10908 ?S 
19:50   0:00 /usr/sbin/httpd
apache2003  0.0  4.2  25736 10912 ?S 
19:50   0:00 /usr/sbin/httpd
apache2008  0.0  4.2  25736 10908 ?S 
19:50   0:00 /usr/sbin/httpd
apache2011  0.0  4.2  25736 10864 ?S 
19:50   0:00 /usr/sbin/httpd
apache2014  0.0  4.2  25736 10900 ?S 
19:50   0:00 /usr/sbin/httpd
root  2644  0.0  0.3   2908   788 tty1 R+ 
20:57   0:00 grep httpd


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