Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
php include_path
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
kleinishere
n00b
n00b


Joined: 23 Nov 2003
Posts: 37

PostPosted: Mon Apr 12, 2004 1:29 am    Post subject: php include_path Reply with quote

I have been running a windows apache 2.0.48 server and have been using require just fine. All I have had to do is type in require("myfilehere"). myfilehere has just been the file relative to the DocumentRoot in window's httpd.conf file. My DocumentRoot in windows was C:\, very insecure I know.

Now I have switched over to apache, have php running and all, but when I use requires it has trouble with the include_path. In windows i never had to change anything for this. I was just able to require the file relative to the DocumentRoot. Now my DocumentRoot is set to /mnt/lshare. I want to just set my include_path to the DocumentRoot so my code will still function correctly.

Can anyone help me?!
_________________
Pain is weakness leaving the body.
Back to top
View user's profile Send private message
johnmc
Tux's lil' helper
Tux's lil' helper


Joined: 04 Oct 2003
Posts: 81
Location: Kansas City, MO

PostPosted: Mon Apr 12, 2004 1:38 am    Post subject: Reply with quote

The PHP libraries and extensions seem to install under /usr/lib/php. The /etc/php/php.ini file include_path directive can be used to add additional search directories.

Good luck!
_________________
Pass the ribs!
----------------------------
17" G4 1.5GHZ Powerbook
Toshiba 5205-S703
----------------------------
"Survived the Dotcom crash and happily toiling for the print media again"
Back to top
View user's profile Send private message
kleinishere
n00b
n00b


Joined: 23 Nov 2003
Posts: 37

PostPosted: Mon Apr 12, 2004 1:43 am    Post subject: Reply with quote

I realize that and I've tried to change the include_path in php.ini.

My question is this:

My DocumentRoot is /mnt/lshare

How do i set my include_path so that it will be /mnt/lshare and look through that?
_________________
Pain is weakness leaving the body.
Back to top
View user's profile Send private message
johnmc
Tux's lil' helper
Tux's lil' helper


Joined: 04 Oct 2003
Posts: 81
Location: Kansas City, MO

PostPosted: Mon Apr 12, 2004 1:55 am    Post subject: Reply with quote

kleinishere wrote:
How do i set my include_path so that it will be /mnt/lshare and look through that?


Add /mnt/lshare to the include path, to make it look like this:

include_path = ".:/usr/lib/php:/mnt/lshare" , for example. Just add a colon and /mnt/lshare at the end of it.
_________________
Pass the ribs!
----------------------------
17" G4 1.5GHZ Powerbook
Toshiba 5205-S703
----------------------------
"Survived the Dotcom crash and happily toiling for the print media again"
Back to top
View user's profile Send private message
kleinishere
n00b
n00b


Joined: 23 Nov 2003
Posts: 37

PostPosted: Mon Apr 12, 2004 1:59 am    Post subject: Reply with quote

i also have this problem on readdir(). i have to put the absolute path. instead of /www/news i have to put /mnt/lshare/www/news. is there anyway that i can change it to just assume /mnt/lshare
_________________
Pain is weakness leaving the body.


Last edited by kleinishere on Mon Apr 12, 2004 2:16 am; edited 1 time in total
Back to top
View user's profile Send private message
johnmc
Tux's lil' helper
Tux's lil' helper


Joined: 04 Oct 2003
Posts: 81
Location: Kansas City, MO

PostPosted: Mon Apr 12, 2004 2:04 am    Post subject: Reply with quote

Hmmm, I'm not sure what that means - some side-effect of safe-mode maybe? I think readdir() is in /usr/lib/php/System.php, which should be in your include_path.
_________________
Pass the ribs!
----------------------------
17" G4 1.5GHZ Powerbook
Toshiba 5205-S703
----------------------------
"Survived the Dotcom crash and happily toiling for the print media again"
Back to top
View user's profile Send private message
kleinishere
n00b
n00b


Joined: 23 Nov 2003
Posts: 37

PostPosted: Mon Apr 12, 2004 2:16 am    Post subject: Reply with quote

dude, i'm sorry, but i'm sorda a noob at this. i looked at the system.php and found something about readdir but it really can't help. i'm sure that not only readdir needs the absolute path, but other functions that i'll need. there has to be something i can change. i changed the include_path to what you said, and i took out the /'s in front of my requires and all of that worked. i thank you for that, but if anyone knows how to change the path so it assumes /mnt/lshare in front of everything that would be awesome!
_________________
Pain is weakness leaving the body.
Back to top
View user's profile Send private message
stuherbert
Retired Dev
Retired Dev


Joined: 17 Aug 2003
Posts: 47
Location: Pontypridd, South Wales

PostPosted: Mon Apr 12, 2004 8:53 am    Post subject: Reply with quote

Have a look at http://uk.php.net/manual/en/function.include.php, which explains the rules that PHP uses for searching for files.

Best regards,
Stu
_________________
--
stuart@gentoo.org
Gentoo Developer
Trustee, Gentoo Foundation
http://blog.stuartherbert.com
Back to top
View user's profile Send private message
johnmc
Tux's lil' helper
Tux's lil' helper


Joined: 04 Oct 2003
Posts: 81
Location: Kansas City, MO

PostPosted: Mon Apr 12, 2004 12:14 pm    Post subject: Reply with quote

kleinishere wrote:
.. if anyone knows how to change the path so it assumes /mnt/lshare in front of everything that would be awesome!


So, adding /mnt/lshare to your include_path directive (from the message above) didn't work?
_________________
Pass the ribs!
----------------------------
17" G4 1.5GHZ Powerbook
Toshiba 5205-S703
----------------------------
"Survived the Dotcom crash and happily toiling for the print media again"
Back to top
View user's profile Send private message
kleinishere
n00b
n00b


Joined: 23 Nov 2003
Posts: 37

PostPosted: Tue Apr 13, 2004 7:14 pm    Post subject: Reply with quote

yes, i added that /mnt/lshare to my include_path and it still didn't work
_________________
Pain is weakness leaving the body.
Back to top
View user's profile Send private message
johnmc
Tux's lil' helper
Tux's lil' helper


Joined: 04 Oct 2003
Posts: 81
Location: Kansas City, MO

PostPosted: Wed Apr 14, 2004 11:22 pm    Post subject: Reply with quote

Can you post your include_path line?
_________________
Pass the ribs!
----------------------------
17" G4 1.5GHZ Powerbook
Toshiba 5205-S703
----------------------------
"Survived the Dotcom crash and happily toiling for the print media again"
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2072
Location: /usa/utah

PostPosted: Thu Apr 15, 2004 2:59 am    Post subject: Reply with quote

just gotta check ... you did restart apache after changing php.ini, right?
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum