says...
> I have a PHP script that attempts to create a temporary file to be used
> during processing. The script is owned by my username (bryanrme) on
> the server. When the script attempts to create the temporary file, I
> get a "failed to open stream: Permission denied" error. The
> permissions on my directory are set to 755. When I set the permissions
> to 757, the creation of the file is successful. In this case, I notice
> that the script spawns a temporary file owned by a user named "99".
>
> Is there any way to avoid this? I'd prefer not to leave my directory
> set at 757, but is there any workaround for this? I checked my server
> configuration and safe mode is not enabled. Any suggestions? I would
> prefer that the script handle the creation, usage, and disposable of
> the temporary file.
(assuming you mean the script is run via a web interface and that this is
a Linux/Apache setup)
PHP runs scripts under the umbrella of the Apache user (looks like this is
user 99 in your setup) with the permissions/etc for that user.
Set up a user group with both (and only) yourself and the Apache user as
members. Set the directory's group ownership to this group (leave the
directory's personal ownership as yourself). Set directory permissions to
775.
Geoff M
>> Stay informed about: PHP Scripts and Creating Files