At 05:33 PM 3/29/2011, Adam Richardson wrote:
> Thanks.
> What do you see if you run this?   "Can't open or create file!"
> Ethan


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
   sudo chmod -R 2775 /home/username/path/to/uploads
   4. Then try the script again.

See if that works.


Nephtali:  A simple, flexible, fast, and security-focused PHP framework

Thanks -

The directory is output_files, which is a subdirectory of /var/www
I'm getting a message "invalid owner" on the command "chown Apache output_files". Also with the -R option, and with apache as the owner, also with the chgrp. All these commands are run as root..

Help and advice please.


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to