|
Home > Archive > Apache Server configuration support > January 2007 > file delete permissions using Apache on XP
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
file delete permissions using Apache on XP
|
|
| abrtlt@yahoo.com 2007-01-29, 1:18 pm |
| I have an Apache 2.24 server on XP. A php script generates an HTML
page and writes a log file. It also writes and then deletes with
unlink() a temporary file in the same directory. It works fine on
Apache running on Linux, but does not delete the temporary file with
Apache on XP:
Warning: unlink(./myfile) [function.unlink]: Permission denied in /
myphp.php
(the file was created successfully with fopen(myfile, "w"))
I am not familiar with the Windows platfom, but I would assume there
is some problem with the file permissions. This problem appears
specific to deleting a file, rather than creating/writing it.
Should I declare a specific umask for the version running on Windows?
Also, how do I control directory permissions _for_ Apache_ in Windows?
Thanks!
Andrew
| |
| shimmyshack 2007-01-29, 7:24 pm |
|
On 29 Jan, 18:36, "abr...@yahoo.com" <abr...@yahoo.com> wrote:
> I have an Apache 2.24 server on XP. A php script generates an HTML
> page and writes a log file. It also writes and then deletes with
> unlink() a temporary file in the same directory. It works fine on
> Apache running on Linux, but does not delete the temporary file with
> Apache on XP:
>
> Warning: unlink(./myfile) [function.unlink]: Permission denied in /
> myphp.php
>
> (the file was created successfully with fopen(myfile, "w"))
>
> I am not familiar with the Windows platfom, but I would assume there
> is some problem with the file permissions. This problem appears
> specific to deleting a file, rather than creating/writing it.
> Should I declare a specific umask for the version running on Windows?
> Also, how do I control directory permissions _for_ Apache_ in Windows?
> Thanks!
> Andrew
this might not be an apache config issue, I doubt its a file
permissions issue.
Do you have XP PRO?
Have you set apache up as a service running under its own user name or
does it run as system (check using taskmanager in username column or
in services.msc unders logon rights)?
have you tried using different forms of the directory separator or
changing directory and unlinking without the './'?
$strPathBeforeUnlink = getcwd();
chdir( 'c:\\path\\to\\directory\\where\\log_fil
e\\is' );
unlink( 'filename' );
chdir( $strPathBeforeUnlink );
Is the file locked while apache tries to delete it - you say you use
fopen, have you close the file handle before you try to delete the
file?
Perhaps you are doing something with the log file while trying to
delete, so have you tried to sleep( $n ) before trying to kill it,
where $n is given in seconds?
Why are you creating a log file and then deleting it again - can you
not just pipe it somewhere, or use memory?
Do you run antivirus on the server or some other process which runs in
the background watching folders/files which is potentially locking the
file?
It is unusual behaviour, I've never seen it (4 years with WA)
| |
|
| <abrtlt@yahoo.com> schreef in bericht
news:1170095765.048521.174860@s48g2000cws.googlegroups.com...
>I have an Apache 2.24 server on XP. A php script generates an HTML
> page and writes a log file. It also writes and then deletes with
> unlink() a temporary file in the same directory. It works fine on
> Apache running on Linux, but does not delete the temporary file with
> Apache on XP:
>
> Warning: unlink(./myfile) [function.unlink]: Permission denied in /
> myphp.php
>
> (the file was created successfully with fopen(myfile, "w"))
Was the file closed _before_ unlink-ing??
On Linux one does NOT have to and delete the file-entry in a directory of a
file in use, creating 'anonymous temporary storage'
> I am not familiar with the Windows platfom, but I would assume there
> is some problem with the file permissions. This problem appears
> specific to deleting a file, rather than creating/writing it.
Unlink-ing a file in use is NOT possible on Windows.
> Should I declare a specific umask for the version running on Windows?
> Also, how do I control directory permissions _for_ Apache_ in Windows?
A default installation of windows and apache SHOULD NOT croak this way.
HansH
| |
| shimmyshack 2007-01-30, 1:31 am |
|
On 29 Jan, 18:36, "abr...@yahoo.com" <abr...@yahoo.com> wrote:
> I have an Apache 2.24 server on XP. A php script generates an HTML
> page and writes a log file. It also writes and then deletes with
> unlink() a temporary file in the same directory. It works fine on
> Apache running on Linux, but does not delete the temporary file with
> Apache on XP:
>
> Warning: unlink(./myfile) [function.unlink]: Permission denied in /
> myphp.php
>
> (the file was created successfully with fopen(myfile, "w"))
>
> I am not familiar with the Windows platfom, but I would assume there
> is some problem with the file permissions. This problem appears
> specific to deleting a file, rather than creating/writing it.
> Should I declare a specific umask for the version running on Windows?
> Also, how do I control directory permissions _for_ Apache_ in Windows?
> Thanks!
> Andrew
sorry didnt spot this part:
> Also, how do I control directory permissions _for_ Apache_ in Windows?
you can only do this properly on XP PRO
(first set up per folder permissions on XP PRO)
goto windows explorer->tools->folder options->view tab->scroll down
uncheck "use simple file sharing (recommended)" -
make sure you have installed apache as service
(add the new apache user)
start->run->compmgmt.msc
expand "local users and groups" [on LHS]
right click users->"new user"
fill in username/password
(use a secure password)
uncheck change at next logon
check never expires
check cannot change
(now remove default permissions, which are too many - of course! -
this is M$ after all)
once user created, double click it [on RHS]
goto "member of" tab
remove all entries.
apache user now has no rights to any directory
(allow apache user access to resources)
right click the directory you need apache to be able to access and
click
"sharing and security"
security tab -> add apache user and give permissions needed.
do this for all the other folder branches apache needs (if any). (it
should be self contained within the folder it was extracted to without
needing %systemroot% or any other special folder unless you are
running programs using php as apache module.)
(now tell apache service about the new user it should run as)
now expand "services and applications" on LHS
click services and in RHS, double click the apache service
in "logon" tab, click "this account" and enter the username password
for apache user
in the recovery tab choose what you want to happen if the service
stops unexpectedly, for instance choose restart on first and second
failures and "run a program" to email yourself on further failures.
restart the apache service by selected it in the services list and
hitting the restart icon on the top panel.
Since you are running php, I assume as a module, you might find you
will need to move php.ini into the apache bin folder. People tend to
have this file floating around in the path, anywhere from php bin to
systemroot, it makes sense to me to put it with the apache executable
since it is running as a module. Should you ever want php to be run
from the command line you can have a php.ini in the pphp bin for that
with different config.
hope that helped.
| |
| abrtlt@yahoo.com 2007-01-30, 7:31 am |
| On Jan 29, 5:33 pm, "HansH" <h...@invalid.invalid> wrote:
> <abr...@yahoo.com> schreef in berichtnews:1170095765.048521.174860@s48g2000cws.googlegroups.com...>I have an Apache 2.24 server on XP. A php script generates an HTML
>
>
>
> Was the file closed _before_ unlink-ing??
> On Linux one does NOT have to and delete the file-entry in a directory of a
> file in use, creating 'anonymous temporary storage'
Thanks everybody - I wasn't closing the file before unlinking, I now
do so and it works fine.
Andrew
|
|
|
|
|