Devine Posted July 29, 2007 Share Posted July 29, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/ Share on other sites More sharing options...
calabiyau Posted July 29, 2007 Share Posted July 29, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-310236 Share on other sites More sharing options...
Devine Posted July 30, 2007 Author Share Posted July 30, 2007 Well is there another way to set it? without using the path "/var/www/html/USER/FOLDER/" ? Like maybe some similar function that doesnt need that full path.. or maybe the correct path usage for this function? Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-310595 Share on other sites More sharing options...
btherl Posted July 30, 2007 Share Posted July 30, 2007 The simple solution is to switch off open_basedir. But it depends on your situation, which you haven't described to us. Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-310601 Share on other sites More sharing options...
Devine Posted July 30, 2007 Author Share Posted July 30, 2007 The simple solution is to switch off open_basedir. But it depends on your situation, which you haven't described to us. My situation, is that it doesnt work.. What else shall I describe about it? Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-310614 Share on other sites More sharing options...
btherl Posted July 30, 2007 Share Posted July 30, 2007 Why do you want to lchown a link that is outside your website's directory? Your website is in /home/ppl, but you are trying to modify files in /var/www Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-310621 Share on other sites More sharing options...
Devine Posted July 30, 2007 Author Share Posted July 30, 2007 It's in my shared account called "ppl".. so it would be accessed by "/home/ppl/FOLDER" ? Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-310631 Share on other sites More sharing options...
Devine Posted July 30, 2007 Author Share Posted July 30, 2007 Now I get an error "Warning: lchown() [function.lchown]: Operation not permitted in /home/ppl/public_html/index.php on line 49"..... yay.......... not.. hah.. help? Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-310633 Share on other sites More sharing options...
btherl Posted July 30, 2007 Share Posted July 30, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-310677 Share on other sites More sharing options...
Devine Posted July 30, 2007 Author Share Posted July 30, 2007 I was going to use chown.. but it didn't work either, so I kept trying lchown instead. Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-310836 Share on other sites More sharing options...
Devine Posted July 30, 2007 Author Share Posted July 30, 2007 *cough* Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311146 Share on other sites More sharing options...
jscix Posted July 30, 2007 Share Posted July 30, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311168 Share on other sites More sharing options...
Devine Posted July 30, 2007 Author Share Posted July 30, 2007 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/ Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311218 Share on other sites More sharing options...
btherl Posted July 30, 2007 Share Posted July 30, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311487 Share on other sites More sharing options...
Devine Posted July 31, 2007 Author Share Posted July 31, 2007 Well now mkdir doesnt work!!! Warning: mkdir() [function.mkdir]: Permission denied in /home/ppl/public_html/index.php on line 61 Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311597 Share on other sites More sharing options...
btherl Posted July 31, 2007 Share Posted July 31, 2007 What directory are you trying to make? Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311599 Share on other sites More sharing options...
Devine Posted July 31, 2007 Author Share Posted July 31, 2007 anything.. just making it the "time" variable right now.. just so when I refresh (if it works, it doesnt make the same thing twice) Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311601 Share on other sites More sharing options...
btherl Posted July 31, 2007 Share Posted July 31, 2007 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']); Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311607 Share on other sites More sharing options...
Devine Posted July 31, 2007 Author Share Posted July 31, 2007 yes... It outputs things? but says my user id is 99 Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311609 Share on other sites More sharing options...
btherl Posted July 31, 2007 Share Posted July 31, 2007 Please post the full output Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311610 Share on other sites More sharing options...
Devine Posted July 31, 2007 Author Share Posted July 31, 2007 I am user id 99 I am in /home/ppl/public_html /home/ppl/public_html is mode 40750, owned by 32149, group 99 Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311611 Share on other sites More sharing options...
btherl Posted July 31, 2007 Share Posted July 31, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311614 Share on other sites More sharing options...
Devine Posted July 31, 2007 Author Share Posted July 31, 2007 Hows managing the SSH keys? lol Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311618 Share on other sites More sharing options...
btherl Posted July 31, 2007 Share Posted July 31, 2007 If you have shell access, login and type "id" (without the quotes), then hit enter. Then post the output here. I am guessing you will be userid 32149 Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311620 Share on other sites More sharing options...
Devine Posted July 31, 2007 Author Share Posted July 31, 2007 I already know I am the user 32149 .. so do I still need shell access? I can edit the files via ftp access still.. just not on the website (via index.php) Quote Link to comment https://forums.phpfreaks.com/topic/62337-function-lchown/#findComment-311624 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.