|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
Is it safe mode or...
Hey you guys, I'm just curious if anyone knows anything about safe mode PHP. My server is running with safe mode on. The problem is that I can't delete files. http://www.haifu.org/test.php will give you all the info about my php enviroment, and the whole page looks like this:
<?php phpinfo(); $c_dir = "/home/httpd/vhosts/haifu.org/httpdocs/1"; // current directory function delete($dir) { if (file_exists($dir)) { umask(0); chmod($dir,0777); if (is_dir($dir)) { $handle = opendir($dir); while($dirname = readdir($handle)) { if ($dirname != "." && $dirname != "..") { delete($dir."/".$dirname); } } closedir($handle); rmdir($dir); } else { unlink($dir); } } } delete ($c_dir); ?> Note: This is the code at http://www.haifu.org/test.php, so you can see all error messages at the bottom of the page. I do have file that I've named "1", it's just an empty file meant for testing. Now the problem that I'm getting is that nither chmod nor unlink work, both blame permissions. Script and the file are in the same category, with same user, and I've even tried to manually set "1"'s permissions to 777. Any ideas oh what I am missing? Thanks |
|
#2
|
|||
|
|||
|
RE: Is it safe mode or...
Ok, I figured out why chmod does not work, my apache is running as a different user, not the same one as the one who owns a file. And I also see that if I allow public execusion of the directory in which I am trying to delete the file, unlink works.
Any ideas of how I can go about executing chmod on directories that are owned by users other then the one apache is running under? Cheers |
|
#3
|
|||
|
|||
|
RE: RE: Is it safe mode or...
Quote:
You have root? Is this your server? |
|
#4
|
|||
|
|||
|
RE: Is it safe mode or...
Yes, postalcow, to both your questions. The only thing is that I would like to do it though PHP, I don't want to go manually through telnet and make changes.
|
|
#5
|
|||
|
|||
|
RE: Is it safe mode or...
You can't.. that's the whole point of Apache being a different user
Well, there's one exception - if you own the containing directory, you can change permissions (i.e. if you own dir/ and someone owns dir/file.txt, you can take ownership of that file). Or, I might be wrong |
|
#6
|
|||
|
|||
|
RE: Is it safe mode or...
Ok, You have an exe cgi-bin that is chmod 755 correct?
then place your script in there have the very first line in the script to be #!/usr/bin/php -q or whatever your path to php is. do a whereis php this line should be before the <?php end the file with a .pl extention and chmod 755 it and own it by root. This should work. REMEMBER!!! this is a security risk!!! Use at your own risk!!! Good Luck ~Cow |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Server Administration > Is it safe mode or... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
![]() |
|