Re: probelm : delete files using PHP
| From: | Richard Lynch | Date: | Thu, 25 Jul 2002 23:53:35 +0000 |
| Subject: | Re: probelm : delete files using PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-109798@lists.php.net to get a copy of this message | ||
>Hi Gurus,
>
>I am using PHP 4.1.1, Postgresql 7.2 and Perl 5.6.0 on Linux.
>
>I want to delete files in a directory,which were created 15 days back.
>
>I can not do it, with PHP filesystem and directory functions, as PHP runs as
>"nobody" user.
>
>Can anybody pls. help me ?
Well...
There are several options:
1. Make the files be delete-able by "nobody" This, of course, means *ANY*
other user on the system can delete them whenever they want to.
2. Use PHP (CGI) running under a cron job to delete the things that are
"old" or somehow marked for deletion by the web-page. The cron job can be
schedule by a real user, and will have all their powers. This is probably
"safest" and "easiest" of all the options.
3. Add another mime-type to httpd.conf and run a *second* PHP as CGI under
that mime-type (and filename extension) and then suExec that to run as the
owner of the files. Once again, *anybody* who can use the mime-type can
then run as that user, so be sure you pin-point the (using httpd.conf
<Directory>) this into a directory only *YOU* can put PHP scripts, or you
might as well just do 1.
4. Write a sudo shell script that allows *ONLY* the files in question
(either restricted by directory or name or something similar) to be deleted
by nobody.
There are probably more options...
--
Like Music? http://l-i-e.com/artists.htm
I'm looking for a PRO QUALITY two-input sound card supported by Linux (any
major distro). Need to record live events (mixed already) to stereo
CD-quality. Soundcard Recommendations?
Software to handle the recording? Don't need fancy mixer stuff. Zero (0)
post-production time. Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo
audio-to-disk.