Jump to content

Recommended Posts

I'm trying to create a user interface thing where when they join they get their own directory(named by their joining username) and the files to view content on are copied from a stored file directory...like if view_profile.php was in the stored directory then I copy the file over to the newly created directory for the user.

 

I use this to create the new directory...as you all know:

 

<?php
$dir_path = $dir_username; //. "/";
$oldmask = umask(0);
@mkdir($dir_path, 0777);
umask($oldmask);
?>

 

and then you the copy function to move all files over thats in the stored directory.

 

BUT!

 

when you try to view any page in the new user's directory I get this error:

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

Please contact the server administrator, webmaster@what.mysite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

 

 

Does anybody know whats going on?

Link to comment
https://forums.phpfreaks.com/topic/75362-whats-the-deal/
Share on other sites

Well I store all my user data in a database like normal people, and then I use a page like view.php?id=UserID and query the db for data.  makes a ton more sense.

 

 

yeah i know how to do that stuff...but i just wanted each user to have his/her own directory

Link to comment
https://forums.phpfreaks.com/topic/75362-whats-the-deal/#findComment-381216
Share on other sites

The reason you get the error is because the server creates your folder as nobody i believe and you are giving it 777 chmod which web users arent allowed to access this .. you want to chown the folder to your webuser name.

 

Check you Ftp program and look at the owner field if u have one it should have a number and if the new folder has 0 then that is the problem above

 

But like cooldude832 said you should use the DB that way and just allow them to have a directory for space ... the method you are using is pretty senseless!

Link to comment
https://forums.phpfreaks.com/topic/75362-whats-the-deal/#findComment-381222
Share on other sites

I'm guessing that this will be running as the Apache user unless you have the PHP equivalent of suexec (suPHP anyone?) so all your files/permissions will be written or done as that user. Thus you cannot chown (to my knowledge) as Apache, because if you could, you would be able to chown apache:apache / bringing the whole server to a standstill.

Link to comment
https://forums.phpfreaks.com/topic/75362-whats-the-deal/#findComment-381234
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.