Web Hosting Talk







View Full Version : Permissions Help!


chads2k2
09-16-2002, 08:02 PM
Ok... I am having a lot of trouble with file permissions now. It seems to be hating me. So that isnt really good. I do not have root access and it wouldnt let me chown it either. SO WTF??

Here is my scripting:

mkdir.php
---------------------------------------
<?php
function createhost($dir) {
mkdir($dir, "777");
$site = "http://www.brokenformula.com/stat.php";
$id = "6";
$bannerlne1 = "Chris Crothers";
$bannerlne2 = "740.881";
$html="<html><head><meta http-equiv='Content-Language' content='en-us'><meta http-equiv='Content-Type'content='text/html; charset=windows-1252'><title>Live Sales Clerk</title></head><body topmargin='0' leftmargin='0'><table border='0' width='100%%' height='100%%' cellspacing='0' cellpadding='0'><tr><td width='100%%' valign='top' height='491'><iframe src='$site' border='0' height='100%%' width='100%%' name='content'></iframe></td></tr><tr><td width='100%%' valign='top' height='61'><table border='0' width='100%%' height='100%%' cellspacing='0' cellpadding='0'><tr><td width='21%%' bgcolor='#000080'><p align='center'><img border='0' src='http://www.domain.com/images/BannerLeft2.GIF'></td><td width='57%%' valign='top' bgcolor='#000080'><p align='center'><font color='#FFFFFF' size='4'>$bannerlne1<br>$bannerlne2</font></td><td width='22%%' bgcolor='#000080'><p align='center'><a href='http://www.domain.com/demo.php?id=$id'><img border='0' src='http://www.domain.com/images/BannerRight2.GIF'></a></td></tr></table></td></tr></table></body></html>";
//$file = fopen("index.php", "a+");
//fwrite ($file,$html);
//fclose($file);
}
$email = "blah@brokenformula.com";
createhost("./$email");
?>
------------------------------
end of mkdir.php



output of file permissions
--------------------------------
total 40
drwxr-Sr-t 2 nobody livesale 4096 Sep 16 18:43 blah@brokenformula.com
drwxrwsr-x 2 livesale livesale 4096 Sep 16 18:57 chad
d-w--wx-wT 2 nobody livesale 4096 Sep 16 18:09 chadsmith@brokenformula.com
drwsrwxrwt 2 nobody livesale 4096 Sep 16 18:17 chriscrothers@brokenformula.com
-rw-rw-r-- 1 livesale livesale 1229 Sep 16 17:40 createfile.php
d-w--wx-wT 2 nobody livesale 4096 Sep 16 17:48 help
-rw-r--r-- 1 nobody livesale 1102 Sep 16 18:34 index.php
-rw-rw-r-- 1 livesale livesale 1447 Sep 16 18:43 mkdir.php
-rw-rw-r-- 1 livesale livesale 231 Sep 16 17:30 showsource2.php
-rw-rw-r-- 1 livesale livesale 149 Sep 16 17:31 showsource.php
---------------------------------
end of output of file permissions


I cannot delete directories or anything b/c they have stuff in them. Well I go in with my FTP program and it says there isnt anything in there. So... i SSHed into the box and tried going to the folder and it said I do not have permission. I know its because I do not "own" it. Well I tried to do a chown livesalesclerk help and it said that I didnt have permission. SO... WTF? I don't have root access to the box either. Its on a shared server. Great company we are with its just I don't think I know what I am doing. So is there something that I can do? Thanks!

Chad R. Smith

PencWeb
09-17-2002, 08:13 AM
to create a dir it's:

mkdir("the_dir", 0777);

Chr1s
09-17-2002, 04:41 PM
function createhost($dir) {
mkdir($dir, "777");




function createhost($dir) {
mkdir("$dir", 0777);

chads2k2
09-17-2002, 04:44 PM
One problem is still who owns the folder. It keeps saying "nobody" where it should be livesalesclerk.... any way to fix that?

Chad

jwalk76
09-19-2002, 10:59 AM
php has been installed as an apache module. when this is the case, all scripts run as the user that the apache daemon runs as...quite often this is "nobody" or "apache" or "www". so, when you run "mkdir" the directory will be created with the ownership of the user that runs the apache daemon. as far as i know, there is no way around this....

chads2k2
09-19-2002, 11:40 AM
YOU ROCK MAN! I didn't know that at all! We do have a www folder but it does run as "Nobody". I was thinking there had to be a way to do a chown or something that could be done. But our server wouldnt take that either. I think its kinda crap though. Php should built something into it (I would but no idea how) so we can run chown's on the folders except we cannot put them to "Root" b/c that would REALLY fk things up eh? Ok man take it easy and thanks again!

Chad