home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

PHP mkdir Driving me crazy!!

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2378
Discussions: 200,959, Posts: 2,379,543, Members: 246,329
Old March 8th, 2007, 03:54 PM   Digg it!   #1 (permalink)
Senior Member
 
reiss's Avatar
 
Join Date: Jan 2004
Location: London UK
Posts: 527
PHP mkdir Driving me crazy!!

the following PHP script works perfect on my home PC -

if($totalRows_info == 0) {
$bandfolder = "../bands/" . $_POST['BandName'];
mkdir($bandfolder,0777,TRUE);
$password=$_POST['password'];

when executed from the server no folder is created.
I changed permissions on the servers 'bands' folder to 777, and still new folders are not created.
the folder 'bands' is located in the servers root directory.
spent an hour on the phone to the servers tech support - they cant help!

can any of you guys help?

I hope so

thanks
__________________
Signature images disabled.
reiss is offline   Reply With Quote
Old March 8th, 2007, 04:52 PM     #2 (permalink)
Banned
 
Iturea's Avatar
 
Join Date: Jan 2004
Location: Earth
Posts: 420
It probably has something to do with: "../bands/" a parent path. There are security reasons why parent paths on some servers are restricted.

Try writing to the same directory first to make sure there is no error there. Then try different combos with the path... ie: the whole path: http://www.yourweb.com/bands/ or /bands/ or whatever...
Iturea is offline   Reply With Quote
Old March 8th, 2007, 05:02 PM     #3 (permalink)
Senior Member
 
reiss's Avatar
 
Join Date: Jan 2004
Location: London UK
Posts: 527
thanks

Tried the whole path, tried /bands/

still - no new folder

aahhhhrggg
reiss is offline   Reply With Quote
Old March 8th, 2007, 05:20 PM     #4 (permalink)
Banned
 
Iturea's Avatar
 
Join Date: Jan 2004
Location: Earth
Posts: 420
try: "\\bands"

Just a thought: I know Windows handles directories differently from Linux.

Last edited by Iturea : March 8th, 2007 at 05:41 PM.
Iturea is offline   Reply With Quote
Old March 8th, 2007, 06:40 PM     #5 (permalink)
Senior Member
 
reiss's Avatar
 
Join Date: Jan 2004
Location: London UK
Posts: 527
thanks again, the server is on a linux system, my home comp is on an apache server. tried this -

if($totalRows_info == 0) {
$bandfolder = "//bands/" . $_POST['BandName'];
mkdir($bandfolder,0777,TRUE);
$password=$_POST['password'];
$message = "User " . $_POST['BandName'] . " has been added to the database";

then tried this -

if($totalRows_info == 0) {
$bandfolder = "\\bands\\" . $_POST['BandName'];
mkdir($bandfolder,0777,TRUE);

even this didnt work -

if($totalRows_info == 0) {
$bandfolder = $_POST['BandName'];
mkdir($bandfolder,0777,TRUE);

I really dont know what else to try, I need these folders creatinging or re-do allot of code that relies on it and im running out of time
reiss is offline   Reply With Quote
Old March 8th, 2007, 08:05 PM     #6 (permalink)
Real gangstas sip on Yacc
 
jkrohn's Avatar
 
Join Date: Oct 2001
Location: Suckas-ville
Posts: 4,552
Send a message via ICQ to jkrohn Send a message via AIM to jkrohn Send a message via Yahoo to jkrohn
Try setting $bandfolder to something static and see if that works.
$bandfolder = "bands/test";
__________________
Signatures blow hard
If your signature contains an ad of any kind, congratulations, you're on my ignore list.
jkrohn is offline   Reply With Quote
Old March 8th, 2007, 10:46 PM     #7 (permalink)
Junior Member
 
Join Date: Dec 2006
Location: Alabama
Posts: 2
Cool

Another idea - Try creating /bandfolder in a permissive directory first, where it WILL work; then try copying/moving it over to /bands, see if /bands will accept a copy or a move operation where it will not accept a mkdir. Good luck, and please let your faithful fans know what works, when it works!
GenX71 is offline   Reply With Quote
Old March 9th, 2007, 04:43 AM     #8 (permalink)
Senior Member
 
reiss's Avatar
 
Join Date: Jan 2004
Location: London UK
Posts: 527
ok this is getting silly
I created a new php file that just contained the following code -

<?
mkdir(bands/test,0777,TRUE);
?>

uploaded it to server and ran it - NOTHING !!!
I double checked folder 'bands' permissions - 777 so its not that.

Its got to be a server problem right?
reiss is offline   Reply With Quote
Old March 9th, 2007, 05:47 AM     #9 (permalink)
Senior Member
 
reiss's Avatar
 
Join Date: Jan 2004
Location: London UK
Posts: 527
OK

I logged in using Putty via SSH and ran command mkdir bands/test
this worked fine and created the folder

Its obviously a permissions issue, I cant change the root folder permissions (nor would I want to)

Is there a way to get php to log into the account, make the directory and log out?
reiss is offline   Reply With Quote
Old March 9th, 2007, 07:46 AM     #10 (permalink)
Senior Member
 
reiss's Avatar
 
Join Date: Jan 2004
Location: London UK
Posts: 527
Fixed - sort of

I have solved the problem using ftp access, not what i wanted, but it works -

<?php
$ftp_server = "*******";
$ftp_user_name = "********";
$ftp_user_pass = "********";


$dir = $_POST['BandName'];

// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
ftp_mkdir($conn_id, $dir);
}


// close the FTP stream
ftp_close($conn_id);
?>

saves me allot of hassle but im not sure how secure this script is, I created a new ftp access account restricting access to the bands folder only.

hope its safe!!

thanks for the help

Last edited by reiss : March 9th, 2007 at 08:05 AM.
reiss is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS is driving me crazy! s7ryk3r Webmastering and Programming 6 April 13th, 2006 11:10 PM
Email problem driving me crazy hokie64 Applications and Operating Systems 1 March 29th, 2006 10:53 AM
New Mic Driving me Crazy! DivaDee Multimedia and Audio 3 April 11th, 2005 02:46 AM
ZoneAlarm is driving me crazy Hickman Networking and Internet 9 September 15th, 2003 10:31 PM
Ok, this is driving me crazy CubKid General Tech Discussion 11 January 11th, 2003 06:54 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2974)
The disrespect of Obama by Russian .. (44)
Making Health Care Worse (180)
Wireless Televisions. (12)
CPU fan stops spinning randomly (9)
Regular Build (11)
windows 7 problem (7)
Laptop with wireless problem. (5)
windows vista security holes (13)
Is the PSU I received dead? (13)
Print spooler problem (16)
radeon x850xt platinum & shader.. (6)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (11)
Recent Discussions
Is the PSU I received dead? (13)
Print spooler problem (16)
Nvidia GTX 260 problem (0)
windows vista security holes (13)
Kingston Bluetooth Dongle Driver (1)
Multiple Restarts Required at Boot (3)
Open With ..... Win7 (1)
webcam (0)
upgrade for hp a6101 (0)
Laptop with wireless problem. (5)
Modern Warfare 2: Who Bought It? (64)
tv not turn on-makes clicking sound (2)
CPU fan stops spinning randomly (9)
EVGA 9800 gtx help with finding a goo.. (11)
Regular Build (11)
Help with onclick and buttons (0)
Virus advise (8)
My monitor won't turn on after instal.. (1)
Internet Lost (3)
Dept. of HS: NSA 'Helped' Develop Vis.. (16)
Point and Shoot Camera Suggestions. (4)
Ideal cheap graph card for PC-Gaming? (18)
radeon x850xt platinum & shader 3 (6)
Graphics Card Upgrade Question (4)
For Sale BFG GTX285 OC2 with 10 year .. (3)


All times are GMT -4. The time now is 10:38 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28