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 ]
|