Re: Permission Denied - Help Requested
| From: | Adam Richardson | Date: | Tue, 29 Mar 2011 21:33:01 +0000 |
| Subject: | Re: Permission Denied - Help Requested | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312134@lists.php.net to get a copy of this message | ||
>
> Thanks.
>
> What do you see if you run this? "Can't open or create file!"
>
> Ethan
OK,
If you're running PHP as an Apache module, by default it won't have
permissions to write to the directory (this is by design to avoid security
issues.) You can do something like the following:
1. Create a directory for writing files outside of your public directory
(let's call it "uploads".)
2. Change the group associated with the directory to Apache:
sudo chgrp -R www-data /home/username/path/to/uploads
3. Change the permissions on the directory so the group has write
permissions:
sudo chmod -R 2775 /home/username/path/to/uploads
4. Then try the script again.
See if that works.
Adam
--
Nephtali: A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com