PHP - Permission Problem I Think Mkdir.
Im in the process of setting up a social media site , Just switched from basic hosting to Dedicated Server
Everything was working till i switched . I have a basic join forum and email activation , On the register.php file it tell script to make a directory mkdir into member/folder like this below, But it will make the folder for the id of that user but will not let them upload any images?. At first it wouldnt even make a folder but i found out it was a permissions issue with my server i fixed it , im guessing the upload is also a permission's issue ? But the script automaticly make the members/"$id" folder and i dont know how to set permission for auto create folder that if i even have to ? so confused. (BEGGGGINGG !! FORRRRR HELPPPPPPPPPPPPPPPPPPPP! Im running a dedicated server with godaddy, On centOs w/ Plesk Panel 9.3.0 ------------------------------------------------------------------------------------------- $id = mysql_insert_id(); // Create directory(folder) to hold each user's files(pics, MP3s, etc.) mkdir("members/$id", 0755); Similar TutorialsHope someone can help me! I have an upload script that stores users files, it creates a dir using the users name which will store their uploads! The problem is because I am on a shared host with safe mode ON i get an error when trying to upload to that directory via a form, the error says something like SAFE MODE Restriction in effect. The script whose uid is 500 is not allowed to access /proc/uptime owned by uid 0 in ...... If I create a dir manually(FTP) it works fine! But I cannot obviously create a dir for each new user as the registration is automatic, so at the moment I have 1 common dir for all users to upload to, but this will eventually cause too much congestion and slow things down! Any ideas! Thanks!! this script is supposed to save my $csvfile to a .sql file name $ouputfile into a folder called files/ $csvfile = $_FILES['file']['name']; //form from another folder $save = 1; $outputfile = "output.sql"; here is the save script if($save) { chmod($csvfile, 0777); if(!is_writable($outputfile)) { echo "File is not writable, check permissions.\n"; //when i execute this script, it goes in here } else { $file2 = fopen($outputfile,"w"); if(!$file2) { echo "Error writing to the output file.\n"; } else { fwrite($file2,$queries); fclose($file2); } } Hello I built a component for a non-profit organisation which want to use the 404page to promote several charities. In order to do that I want to place a file 'error.php' in the map 'templates/system'. I use the RENAME function for that. So far so good. On many sites it works fine, but on other sites I get an error on the rename function. The user-id and the group-id of the script I use are the same as the uid's of 'templates/system'. So there shouldn't be a problem. If I add public write to the filepermissions of 'templates/system'/ with Filezilla the error disappears. But I can't do that with the php chmod function, again because of too less priviliges. HELP, I can't find an explanation for that and that's driving me crazy. thanks in advance So i am on a shared host and it seems that only 777 allows me to upload images on a certain folder , not 755 , just 777... is it because of the shared host or thats how it works? PS: i really didnt know where to post it so if a mod can move it , i'd appreciate it. I am getting this error Warning: ftp_put() [function.ftp-put]: Can't open that file: Permission denied in /home/chris/public_html/site-name/wp-content/setup.php on line 62 Code: [Select] $conn_id = ftp_connect($host, 21) or die ("Cannot connect to host"); ftp_login($conn_id, $usr, $pwd) or die("Cannot login"); // turn on passive mode transfers (some servers need this) // ftp_pasv ($conn_id, true); $upload = ftp_put($conn_id, $file[0], $file[1], FTP_ASCII); print (!$upload) ? die('Cannot upload') : 'Upload complete'; print "\n"; The permissions to the file is 0644, if I change it to 0777 ftp_put complains and says the file is not found. How can I ftp this file? What is going on? Thanks, Chris Hi. I'm using SimpleImage.php to do some basic image manipulation. The code is here http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php, but I don't think all the details are important. Basically, I'm trying to read and image and save it with a different name. I'm really new with this stuff, so it's probably something simple. Anyway, here is the code throwing the error, $image_info = getimagesize($filename); where $filename is a string containing the path to the image I want to load, e.g. $filename="images/picture.jpg"; It's throwing a "Read Error!" I know that the path is correct. In fact I first check if the file is there using is_file($filename); and it returns true. I'm guessing that maybe php does not have "permission" to read this file. The permissions for the file are -rw-r--r-- 1 www-data www-data 80211 2011-04-20 16:19 picture.jpg Looks like everyone has "read" permission, so I don't see what the problem is. Also, the permissions of the folder and all parent folders are 777. Not sure what the problem is. I might be way off by guessing that it is a permissions problem. Any help would be great. Thanks. Also, I was wondering if there is a way for this forum to email me whenever there is a reply to my posts. I can't seem to find the option anywhere. I have a PHP web system that store in a windows server. In the system, there is a function for user to upload files to another server (Shared server in Unix). When i try to upload a file, it gives warning: Warning: move_uploaded_file(\\unixserver/sharedfolder/upload/test.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\wamp\www\upload\index.php on line 40 For your information, my username has been assigned in xxx's group that has access to read and write on that folder. Besides, i'm able to open,create and delete files on that folder's server manually (samba). The safe mode setting is off. Does anybody has any idea why this thing happen? Hello, I was wondering if it was possible to do mkdir() on a windows server, I know it is so I'm going to continue asking my question. I've to make a form, with the action as 'something.php' for example. The 'something.php' file has this in it '$name = $_POST['filename'];''. I was wondering if it was possible to get what was imputted in the form that I did in HTML, to make a file in 'C:\thirdir\$name'. That probably doesn't make any sence, if you get it you're a legend. Hi I am running a linux web server and I am trying to use the mkdir function, for somereason I keep getting an error when I try run: // $clanid is set above mkdir('clans/' . $clanid . '/'); I receive the error: Code: [Select] Warning: mkdir() [function.mkdir]: No such file or directory in /home/kdmrhos1/public_html/ClanFind/register.php on line 253 Hi, I want to create a directory named according to the users ID which is auto incrementing. I want to a create the directory only if they have successfully registered. In more clear words the directory should be as 1 2 3 onwards. A bit of guidance would be appreciated with the mkdir function and how can i get the user ID exactly after they have registered before they sign in is this possible? Hi. I'm trying to create a directory folder on my server. I am using the following code, but keep getting an error? The images folder is set to 0777 on the server, and the file is located just outside the images folder. Code: [Select] $uID = $new_user->id; mkdir('/images/'.$uID.'/main/thumb', 0777, true); mkdir('/images/'.$uID.'/main/large', 0777, true); Error: Warning: mkdir() [function.mkdir]: Permission denied in /home/p/o/powtest/web/public_html/test_users.php on line 19 Warning: mkdir() [function.mkdir]: Permission denied in /home/p/o/powtest/web/public_html/test_users.php on line 20 Thanks for your help Okay I finally got some bugs worked out, but after further testing I found new bugs. The variables $loggedinid and $pid are working. I am receiving the following error: "An error occured: Warning: mkdir() [function.mkdir]: No such file or directory in D:\Hosting\5366560\html\file_upload\server\script.php on line 131" Now when I go to line 131 in script.php mkdir("../uploads/$loggedinid/$pid", 0777); What should my next step be? I am not sure where to start. Adam I am running php 5.3.2 on Win Server 2008 R2 (IIS 7). When I execute the mkdir() function and pass it a string (i.e., the path) longer than 256 characters, it throws an error indicating "result too large". My question is whether this is because the mkdir() function cannot handle a string larger than 256 char or if it is a Windows issue on max characters allowed (path length). Any feedback or recommendations will be appreciated. I'm doing a flash app where i save webcam images to a folder on the server. I'm able to make this work when running of xampp on my machine, I create the required folder structure and I'm able to read from that folder and display the images, however once i move the stuff onto a live server, it fails to create the folders and it seems to be a permission problem. Is it server specific? i've tried chmod etc but I don't think i'm doing it right. any help, pointers for a non php developer would be most helpful. here's my code snippet <?php //This project is done by vamapaull: http://blog.vamapaull.com/ //The php code is done with some help from Mihai Bojin: http://www.mihaibojin.com/ $uid = $_GET[uid]; $structure = './images/' . date("Ymd") .'/' . $uid. '/'; // To create the nested structure, the $recursive parameter // to mkdir() must be specified. if(is_dir($structure)) { echo "Exists!"; } else { echo "Doesn't exist" ; if (!mkdir($structure,'0777', true) ) { die('Failed to create folders...'); } } if(isset($GLOBALS["HTTP_RAW_POST_DATA"])){ $jpg = $GLOBALS["HTTP_RAW_POST_DATA"]; $img = $_GET["img"]; $filename = 'images/' . date("Ymd"). "/" .$uid. "/img_". mktime(). ".jpg"; file_put_contents($filename, $jpg); } else{ echo "Encoded JPEG information not received."; } ?> Hi, I want to create a folder for every auto incrementing row so I used this $id=mysql_insert_id(); mkdir("../Setting/time/".$id); I am getting an error Warning: mkdir() [function.mkdir]: No such file or directory in C:\xampp\htdocs\Setting\time\index.php I have used the mkdir function in this similar method before there was no problem. For some reason it is not working now. If I just try it on a blank page example the following method seems to work could some one point to me what I might be doing wrong? $tid=1; mkdir("../Setting/time/".$tid); Hey, I'm currently making a little script which I often get a string like = "images/folder/something/maybeanotherone/file.ext" so I'm interresting to know how could I create every directory in the correct order and the numbers of sub-directory isn't fix, so if anybody can give me an hint, I would appreciate =D Btw, tell me if I'm you don't understand what I mean, English isn't my primary language. I have problem creating multiple sub-directories inside a single directory using mkdir: mkdir("files/".$lname,0777); mkdir("files/".$lname."/CV",0777); The above command works fine and creates the directory under $last name as files/$lname/CV. But I am unable to create further sub-directories inside $lname. For eg: mkdir("files/".$lname."/Cover", 0777); (This does not create the directory Cover) this is how my code snippet looks like if($result) { mkdir("files/".$lname,0777); mkdir("files/".$lname."/CV",0777); mkdir("files/".$lname."/Cover", 0777); mkdir("files/".$lname."/LOR", 0777); } I am trying to create a folder using amfphp using this method: <?php function createProject($dir) { $query = mysql_query("SELECT * FROM projects WHERE proj_path = '$dir'"); $num = mysql_num_rows($query); if ($num > 0) { return "folder already exists"; } else { $root = $_SERVER['DOCUMENT_ROOT']; $theDir = $root . $this->dataFolder . "/" . $dir; //return $theDir; -> "/home/content/c/s/8/cs8xo/html/xxxxxxx/project_data/testfolder2" return mkdir($theDir,0755); } } ?> I've commented out what $theDir returns when I pass it a $dir. $this->dataFolder == "/xxxxxxx/project_data" When I return the mkdir(), I get this error: Code: [Select] (Object)#0 message = "faultCode:AMFPHP_RUNTIME_ERROR faultString:'mkdir(): No such file or directory' faultDetail:'/home/content/c/s/8/cs8xo/html/xxxxxxx/amfphp/services/clientlogin2/Projects.php on line 147'" name = "Error" rootCause = (null) Line 147 is referring to the mkdir() line. Can anyone spot anything obvious that I could be missing? Hi, I wonder whether someone may be able to help me please. I'm fairly new to PHP so please bear with me. I'm trying to put together a script which bascially creates a hierarchical tree of folders upon a new account being created by a user. I would like to take the 'username' that the user registers with to use as the name for the first folder, then, create a folder at the second level called 'images' and then finally, a folder within that called 'thumbs'. From the research that I've done, I believe that I need to use the 'mkdir' command, but I can't find a very straight forward tutorial. I just wondered whether someone could perhaps please help me out with this, so that I at least have a good solid starting point. Please help. I am simply trying to create a directory if it doesn't already exist. I am working from one site (www.mysite.com/folder1/folder2/folder3/here). I want to have this PHP script make a directory on another one of my sites (www.mysite2.com/images) $dirname = "../../mysite2.com/images"; <--this is the root directory (www.mysite2.com/images) $filename = "/$sitest/$userid/"; <-- this is the folder we want to create if it doesn't already exist (www.mysite2.com/images/us/27) $fulldirname = "$dirname$filename"; <--this should be the total path (mysite2.com/images/us/27) if (file_exists($fulldirname)) { echo "The directory {$fulldirname} exists"; } else { mkdir($fulldirname, 0777); echo "The directory {$fulldirname} was successfully created."; } |