Re: temp files
| From: | Richard Lynch | Date: | Fri, 27 Jul 2007 05:46:27 +0000 |
| Subject: | Re: temp files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-259641@lists.php.net to get a copy of this message | ||
On Wed, July 25, 2007 3:55 am, admin wrote:
> $lines =
> gzfile("http://www.example.com/some/resource");
>
> for its internal needs gzfile() creates a temp file such as
> /var/tmp/phpFjJxNX where the gzipped resource is kept. The file stays
> there forever and eventually the fs runs out of inodes. Any way to
> unlink the temp file from the script? I've found no api for that.
> Alternative code:
>
> $lines =
> file("compress.zlib://http://www.example.com/some/resource");
>
> does the same thing still leaving the file around.
>
> Using PHP 4.3.3RC4 (built: Aug 24 2003 14:59:14)
> This could be a bug, but upgrading is not an option.
$files = glob('/var/tmp/php*');
foreach($files as $file){
if (fileatime($file) < time() - 60*60*24*7) unlink($file);
}
You're on your own to convert that into something PHP 4.3.3RC4 can
actually do with:
http://php.net/readdir
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?