At 12:07 AM 3/30/2011, Adam Richardson wrote:
On Tue, Mar 29, 2011 at 8:21 PM, Ethan Rosenberg <eth...@earthlink.net>wrote:

> 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
>>
>>
>> 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
>>
> ++++++++++++
>
> 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.
>
> Ethan
>
>
Hi Ethan,

I might be missing something.

Did you set up the user Apache? On a standard install for Debian (using
apt-get), apache is usually set up as the user/group www-data:
http://wiki.debian.org/Apache

<http://wiki.debian.org/Apache>The root user typically owns the /var/www
directory. I usually set up virtual hosts within one of the other accounts
and then change the group on a directory outside of the public directory
specifically set aside for uploads and run the commands I sent.

However, in the case of your example, I believe you can just run the 2
commands I sent on the /var/www/output_files directory and you should be
able to write the files.

sudo chgrp -R www-data /var/www/output_files
sudo chmod -R 2775 /var/www/output_files

Hope this helps, and sorry if I misunderstood something in your
configuration or troubleshooting.

Adam

--
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

++++++++++++++++++++++++
Adam -

Thanks.

Works beautifully.

Ethan


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to