How to make PHP create Directories and Sub-Directories and be able to Write to them? [duplicate]
Possible Duplicate:
How do I configure PHP to have permission to create directories and make files?
How can I make PHP create Directories and Sub-Directories and be able to Write to them?
My host is telling me that I will need to install suPHP to be able to do that but I would rather not install a Mod on a live site, especially for something that sounds so simple (creating dirs and writing to them).
Basically, I need PHP to be able to create directories and su开发者_运维知识库b-directories within a folder in my web root and then be able to write to those directories and sub-directories.
Also, mkdir() is not working.
Thanks.
Use mkdir()
: http://php.net/manual/en/function.mkdir.php
Did you try to use mkdir('dirname')
? Note that you'll probably need W-permissions on the root-folder, otherwise you won't be able to actually create the new directory.
suPHP would help you with permission issues, and that's probably your current issue. You may need a combination of chmod() and mkdir() to be able to create directories writable by your web user. the permission you'll need on those folders would be 0777.
精彩评论