• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

How to create directory outside of httpdocs?

S

sparkybarkalot

Guest
I'm new to Plesk, and a bit new to Linux, so I hope this isn't a silly question. I like to have certain files (password includes, php includes, etc) be one directory up from my web accessible directory (in this case httpdocs). I can't seem to be able to create a directory there... i'm getting errors saying I dont have permissions to run mkdir. Anyone have any ideas how I can create a directory one up from my httpdocs directory, and how to make that directory accessible to PHP scripts running in httpdocs? Thanks very much.
 
Well .. you'll need root-access on your server to change the permissions set on the parent directory.

But i wouldn't recommend to change the default file settings.
 
Thanks for the reply. I was under the impression that if I created a directory with root then it wouldn't be readable by the web server user. It sounds like you think it will work (even though you don't recommend it) so I'll give it a try. Thanks again.
 
By default it won't be readable by Apache webserver ... that's why you will have to 'chown' it (change ownership).

So as root you could do:

#mkdir newdirectory
#chown yourftpusername:psaserv newdirectory
#chmod 750 newdirectory

That should do it.

But it's not recommended i think .. i'm not sure whether this stuff will be backed up or will exist after a Plesk update.

Goodluck
 
Thanks a mint BoXie. That not only answers this question, but finally sheds light on setting ownership, which I've wondered about for a while. I owe you one.
 
I have also been wondering how to create a new directory outside my httpdocs directory. Thank you for clearing that up !

I still have a problem though. Although I've created the directory and set the ownership and group, I am unable to access that directory using my php scripts. I can ftp to the directory fine, but I need to access it using my scripts (such as uploading a file to that directory, from a web page).

Any help would be appreciated. I've searched these forums with a variety of keywords, but haven't met with any success on this problem.
 
Might be impossible by default .. because Plesk sets an Open Basedir directive in your http config files.

You'll have to modify it yourself.
 
Sorry for sounding like a newbie... but would removing that setting be okay? Or do I need to change it to something else?

I do have root access, but this is the first time I've ever had this level of access to a server, so I don't know everything there is to know about this... (I'm working on it though!)
 
Well .. you could add another directory to it ... it defaults to /tmp and /httpdocs i guess.

But do not mess with it too much .. it can make the whole thing insecure ..

So you'd better add a specific directory .. than remove the existing ones.

For more info .. check the php manual.
 
Thanks alot Boxie. I'll take a look around the web for more details about that setting
 
Back
Top