Discussion » Tech Support

This is a read-only copy. The forum ran on iamcal.com from 2000 until its database was lost in 2016, and this topic was rebuilt from copies saved by the Internet Archive's Wayback Machine. Some replies may be missing.
Posted by Grim..., 15:15, 4th November 2003:
 
Live chat tech-support is a great idea.
It helps if the guy you are talking to has used a computer before, though...

My query is why I'm getting a permission denied error when trying to create a directory in PHP with the MKDIR command.

My code looks like this:
//create a user folder
$path = "class/useruploads/".$code;
if (! mkdir ($path, 0755))
{
//need to create folder manually - possibly send a mail in the futire?
}


And here's the conversation...

------------------------------------------------------------

System: Please Wait while connecting to an operator

You're connected to operator - DFL-ALEN

DFL-ALEN: Welcome to dataflame support.

Matt Squirrell: Thakns

Matt Squirrell: thanks*

Matt Squirrell: Did you get my question, or do I need to ask it again?

DFL-ALEN: Please provide us your domain name, FTP username & password

DFL-ALEN:

DFL-ALEN:

Matt Squirrell: Domain is hsmx.com

Matt Squirrell: FTP username is lalala

Matt Squirrell: password is

Matt Squirrell: hang on, I can't remember

Matt Squirrell: with you in a second

DFL-ALEN: from where are you doing MKdir

Matt Squirrell: lalala

Matt Squirrell: ^^

Matt Squirrell: password

DFL-ALEN: are you making the directory from ftp client?

Matt Squirrell: No, I'm trying to do it automatically in PHP.

Matt Squirrell: Every time a user joins, their own personal 'images' folder is created

Matt Squirrell: or not, as the case may be

DFL-ALEN: is there a script that creates the directory?

Matt Squirrell: yes, httpdocs/nf/registration.php - line 50

DFL-ALEN: ok then have you checked the script

DFL-ALEN: if there are any errors in it

Matt Squirrell: The script is fine

Matt Squirrell: the error is 'permission denied' which means that the server is stopping it for some reason

DFL-ALEN: ok please wait I'll check

Matt Squirrell: thanks

DFL-ALEN: please can you expalin me the stepwise working of the script

Matt Squirrell: Okay

DFL-ALEN: so that I can check the fault

Matt Squirrell: Well, this script generates a unique 10-digit number for each user.

DFL-ALEN: ok

Matt Squirrell: It then tries to create a folder for that user, so the user can store images in it, etc

Matt Squirrell: (This is for a forum, like PHPBB)

DFL-ALEN: does it chreate a directory for the user?

DFL-ALEN: ok

Matt Squirrell: However, when the script tries to make the folder, a permission denied error is returned

Matt Squirrell: Just making a script with one line of code:

Matt Squirrell: mkdir ("/thisdirectory", 0755);

Matt Squirrell: will fail with the same error

DFL-ALEN: can you tell where the error comes? is it in the browser?

Matt Squirrell: the error is displayed in the browser, yes

DFL-ALEN: ok I will try a test accout

Matt Squirrell: Thanks

DFL-ALEN: I am able to create a account

DFL-ALEN: username : testing

DFL-ALEN: password : testing

Matt Squirrell: Yes, I have supressed the error for now

Matt Squirrell: give me a second and I will turn it back on#

Matt Squirrell: (sorry - I forgot about that)

DFL-ALEN: what did you do to suppres the error?

Matt Squirrell: Turn errors off :)

Matt Squirrell: error_reporting(0);

DFL-ALEN: ?

DFL-ALEN: ok have you removed some of the code from the script to get rid of the error?

Matt Squirrell: No, I have added some code to make sure the error is not displayed

DFL-ALEN: ok then the problem is solved

Matt Squirrell: Err, the folder still isn't being created

DFL-ALEN: ok where the folder is created

Matt Squirrell: I want the folder to be created in the nf/class/useruploads directory

DFL-ALEN: ok let me check

DFL-ALEN: this is coding problem as I am not able to see the code for creating a directory anywhere in the registration.php script

DFL-ALEN: sorry I found it

DFL-ALEN: there is no code in the if statement, only a comment

Matt Squirrell: the IF statement is the code. If the statement is true, then the MKDIR command has failed.

DFL-ALEN:

DFL-ALEN: no there must be some other code in PHP

Matt Squirrell: Hmm, okay, well I'll look into it

Matt Squirrell: thankyou for your help.

DFL-ALEN: Anything else that i can help you with?

Matt Squirrell: I doubt it.

DFL-ALEN: Thank you,have a nice time.

Matt Squirrell: Bye.
Posted by friday, 15:20, 4th November 2003:
 
LOL @ I doubt it!
Posted by beargod, 15:27, 4th November 2003:
 
Dude that seems an awful waist of time, for him to say, nope its something else
Posted by Grim..., 16:01, 4th November 2003:
 
The most important bit is that he's wrong, it not my code GRR!
Posted by cal, 16:31, 4th November 2003:
 
make sure the folder that you're creating the folder inside of is group writable. if that still doesn't work, make it world writable (since then you're ftp user isn't in the same group as the user running the web server).
Posted by tommorris, 16:46, 4th November 2003:
 
Sings to myself: "It's all about the Permissions, baby! Yeah, yeah, yeah!"