Re: filetype() and exec() issues

From: Date: Tue, 24 Apr 2007 06:17:45 +0000
Subject: Re: filetype() and exec() issues
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-253560@lists.php.net to get a copy of this message
On 4/24/07, dev@edoceo.com <dev@edoceo.com> wrote:
This question is a two parter.... a) anyone else noticing filetype() failing on ISO image files? Warning: filetype(): Lstat failed for /var/lib/samba/some/file.iso
Nope, didn't fail for me. But what exactly do you want to know about the file? filetype only check wheter the the argument given is a fifo, char, dir, block, link, file, or unknown. What you're doing below with the file command is getting the content type, there you could use the function mime_content_type, but it is deprecated, and seems not to work always. The manual forwards you to the fileinfo functions: http://www.php.net/manual/en/function.finfo-file.php example 592 does what you're doing with the file command below.
b) I have a script that during processing will eventually call exec('/usr/bin/file -bi '.$file) over 1000 times, I've added a counter and when it dies on this line it's always after 1020 exec calls, regardless of the file name I'm feeding to file. I've reproduced this with both exec, shell_exec, system and the backticks. What am I missing here?
Why does it die? Is it because te max execution time reached? then you should extend the max executon time: http://www.php.net/set_time_limit Tijnema <snip>

« previous php.general (#253560) next »