set root in php: chroot?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
potato
Forum Contributor
Posts: 192
Joined: Tue Mar 16, 2004 8:30 am
Location: my lovely trailer, next to the big tree

set root in php: chroot?

Post by potato »

Hey,

does anybody knows how to set the root in php?
i found chroot php function.

But i get 'Call to undefined function: chroot()' error.
how do i call this function properly?

I've seen that this function requires at least vesrion 4.0.5
Mine is 4.4.4, so normally that wouldn't be a problem.

Anyone knows?

thanx
User avatar
potato
Forum Contributor
Posts: 192
Joined: Tue Mar 16, 2004 8:30 am
Location: my lovely trailer, next to the big tree

Post by potato »

i also found that your server has to be configured for the chroot function.

How i check if it is configured or not?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

you could try this little piece of code to see if the function is available to you

Code: Select all

if(function_exists('chroot'))
{
   echo 'exists';
} else
{
   echo 'does not exist';
}
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
potato
Forum Contributor
Posts: 192
Joined: Tue Mar 16, 2004 8:30 am
Location: my lovely trailer, next to the big tree

Post by potato »

ok, its not available

is there another way of doing it?

ps thanx for the reaction
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: set root in php: chroot?

Post by volka »

Bevibed.be wrote:I've seen that this function requires at least vesrion 4.0.5
Mine is 4.4.4, so normally that wouldn't be a problem.
There are more requirements
http://de2.php.net/chroot wrote:This function is only available if your system supports it and you're using the CLI, CGI or Embed SAPI.
Post Reply