file delete permissions using Apache on XP
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > file delete permissions using Apache on XP




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    file delete permissions using Apache on XP  
abrtlt@yahoo.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-29-07 06: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






[ Post a follow-up to this message ]



    Re: file delete permissions using Apache on XP  
shimmyshack


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-30-07 12:24 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

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)






[ Post a follow-up to this message ]



    Re: file delete permissions using Apache on XP  
HansH


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-30-07 12:24 AM

<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








[ Post a follow-up to this message ]



    Re: file delete permissions using Apache on XP  
shimmyshack


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-30-07 06: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.






[ Post a follow-up to this message ]



    Re: file delete permissions using Apache on XP  
abrtlt@yahoo.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-30-07 12:31 PM

On Jan 29, 5:33 pm, "HansH" <h...@invalid.invalid> wrote:
> <abr...@yahoo.com> schreef in berichtnews:1170095765.048521.174860@s48g200
0cws.googlegroups.com...>I have an Apache 2.24 server on XP. A php script ge
nerates 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






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:32 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register