Jump to content

function: lchown


Devine

Recommended Posts

I get the following error:

 

Warning: lchown() [function.lchown]: open_basedir restriction in effect. File(/var/www/html/ppl/beta/) is not within the allowed path(s): (/home/ppl:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/ppl/public_html/index.php on line 49

 

How can I make it have access?

Link to comment
Share on other sites

open_basedir, I believe is set in your php.ini file.  Are you working on your own server?  As I understand it, it sets paths that php is allowed to operate on files.  If the file you're trying to work with is outside that file system path then you get this error. So your error message is telling you what these allowed paths are and that your file you're trying to work with is not in one of those paths.  so if it's your own server, change the paths in php.ini. 

Link to comment
Share on other sites

Ok, that's better.  First, are you really trying to lchown a symbolic link?  There's usually very little reason to do that.  Normally you would use chown() on a standard file.

 

Secondly, do you have permission to chown files?  Usually that will require root (superuser) access.  This also comes back to the question of why you are using lchown(), because it is a very unusual function to use.  If you explain what you are trying to do, then perhaps we can suggest an alternative.

Link to comment
Share on other sites

if it's your server, you would be able to chown under your OS, and would have no need to do it through php.

 

if your trying to gain access to other peoples files, we arent going to help you.

 

it's not my server, but it is my shared hosting account.. I'm trying to chown a file thats a folder down.. not up..

 

So the index file is: site.com/index.php

And the folder I'm trying to chown with the index.php file is: site.com/support4/

Link to comment
Share on other sites

If it's a shared hosting account and you do not have root access, then you cannot chown or lchown.  It doesn't matter where the file is or who it belongs to.  It just can't be done.

 

If you explain why you need to chown, then perhaps we can suggest an alternative.  Probably you need chmod instead.  chmod can be used to give other users permission to use files that belong to you.

Link to comment
Share on other sites

Can you run the following script:

 

print "<pre>";
print "I am user id " . posix_getuid() . "\n";
$cwd = getcwd();
print "I am in $cwd\n";
$stats = stat($cwd);
printf("$cwd is mode %o, owned by {$stats['uid']}, group {$stats['gid']}\n", $stats['mode']);

 

Link to comment
Share on other sites

There is your problem.  The directory you are trying to write to is owned by user id 32149, but your script is running as user id 99.  Your script does not have permission to write to that directory.

 

Do you have shell access on that machine?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.