lpxxfaintxx Posted March 22, 2006 Share Posted March 22, 2006 I have[code]<?php$ownerdir = $owner;define ('DIRECTORY', '/home/lpxxfain/public_html/members/'.$ownerdir);UPLOAD CODE HEREdo { $dir = DIRECTORY; while (!is_dir($dir)) { $basedir = dirname($dir); if ($basedir == '/' || is_dir($basedir)) mkdir($dir,0777); else $dir=$basedir; }} while ($dir != DIRECTORY); REST OF CODE HERE?>[/code]It never makes the folder, and just skips on to the rest of the script. I don't know whats wrong :(If I do a simple [code]<?phpmkdir("/home/lpxxfain/public_html/members/testing", 0700);?> [/code], it works and makes the folder but if I do [code]<?phpmkdir("/home/lpxxfain/public_html/members/".$owner, 0700);?> [/code] then it says the folder already exists when it doesnt.Ahh, I'm so frustrated! Quote Link to comment https://forums.phpfreaks.com/topic/5539-mkdir-problems/ Share on other sites More sharing options...
redarrow Posted March 22, 2006 Share Posted March 22, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]If I do a simple [code]<?phpmkdir("/home/lpxxfain/public_html/members/testing", 0700);?> [/code], it works and makes the folder but if I do [code]<?phpmkdir("/home/lpxxfain/public_html/members/".$owner, 0700);?> [/code] then it says the folder already exists when it doesnt.[/quote]echo out $owner.Cheek to see what the varable is holding.Try this should make a dir me.[code]<?php$owner="me";mkdir("/home/lpxxfain/public_html/members/".$owner, 0700);?> [/code][code]$owner is not set see my above example.<?php$owner="john";// This will work now with the dir john.$ownerdir = $owner;define ('DIRECTORY', '/home/lpxxfain/public_html/members/'.$ownerdir);UPLOAD CODE HEREdo { $dir = DIRECTORY; while (!is_dir($dir)) { $basedir = dirname($dir); if ($basedir == '/' || is_dir($basedir)) mkdir($dir,0777); else $dir=$basedir; }} while ($dir != DIRECTORY); REST OF CODE HERE?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5539-mkdir-problems/#findComment-19796 Share on other sites More sharing options...
ToonMariner Posted March 23, 2006 Share Posted March 23, 2006 are other directories created using scripts? (I see the dir name is given by the owner name).Have a look and see if openbasedir is set in your php.ini - if it is no php script will be able to conductg and file/directory manipulation outside that directory. Quote Link to comment https://forums.phpfreaks.com/topic/5539-mkdir-problems/#findComment-19804 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.