ID:               22275
 User updated by:  hans at nyu dot edu
 Reported By:      hans at nyu dot edu
 Status:           Analyzed
 Bug Type:         Unknown/Other Function
 Operating System: RedHat 6.2 (2.2.14)
 PHP Version:      4.3.1
 New Comment:

OK, this makes sense then.  If I set the following in php.ini:

mime_magic.magicfile = "/usr/local/apache/conf/magic"

everything appears fine.  If I also set that directive to a
non-existent file, I don't get the Warning either.  However, if I set
it to my system's magicfile, /usr/share/magic, I get the warnings.

With your clarification this makes sense, however maybe this is a
documentation issue.  While
http://www.php.net/manual/en/ref.mime-magic.php says this extension is
derived from Apache mod_mime_magic, the Installation and Runtime
Configuration sections are misleading, in my opinion.

In Installation:

"The extension needs a copy of the magic.mime as distributed with the
file command. This file also part of most recent Linux distributions
and usually stored in the /usr/share/misc directory."

And in Runtime Configuration the default value
"/usr/share/misc/magic.mime" seems that it would never be a correct
value.

Oddly enough, the default /usr/share/misc/magic.mime file doesn't exist
on my system, and without the mime_magic.magicfile directive set, I
still receive the Warnings.  I mention this as odd because when setting
the directive explicitly to a non-existent file I don't get any
warnings.

Anyway, thanks for the clarification,

Hans


Previous Comments:
------------------------------------------------------------------------

[2003-02-18 11:57:42] [EMAIL PROTECTED]

mime magic extension only supports simplified magic files that come
with Apache distribution for now, as most part of its code is taken
from mod_mime_magic.


------------------------------------------------------------------------

[2003-02-18 09:46:40] hans at nyu dot edu

Hopefully I'm not missing something obvious.  After downloading PHP
4.3.1 to a RedHat 6.2 box, I configured and compiled like so for use as
a CLI bin:

./configure
--prefix=/usr/local/psh --disable-cgi
--disable-ipv6 --with-openssl=/usr/local/ssl
--with-zlib --enable-bcmath
--with-bz2 --enable-dio
--enable-ftp --enable-mime-magic
--with-mysql=/usr/local/mysql --with-ncurses
--enable-pcntl --with-readline
--enable-shmop --enable-sockets
--enable-sysvmsg --enable-sysvsem
--enable-sysvshm

Everything happily compiles and installs, but when finally running the
binary as /usr/local/psh/bin/php -v the following is spewed out:

HTTP/1.0 0 X
Content-type: text/html

PHP Warning:  mime_magic: (line 3859) offset `&0        string          >\0            
         %s                      '
invalid in Unknown on line 0
PHP Warning:  mime_magic: type &0       string          >\0                     %s     
                  invalid in
Unknown on line 0
PHP Warning:  mime_magic: (line 3860) offset `&0        string          >\0            
         %s                      '
invalid in Unknown on line 0
PHP Warning:  mime_magic: type &0       string          >\0                     %s     
                  invalid in
Unknown on line 0
PHP Warning:  mime_magic: (line 3861) offset `&0        string          >\0            
         %s              '
invalid in Unknown on line 0
PHP Warning:  mime_magic: type &0       string          >\0                     %s     
          invalid in Unknown
on line 0
PHP Warning:  mime_magic: (line 3862) offset `&0        string          >\0            
         %s              '
invalid in Unknown on line 0
PHP Warning:  mime_magic: type &0       string          >\0                     %s     
          invalid in Unknown
on line 0
PHP 4.3.1 (cli) (built: Feb 17 2003 22:13:02)
Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies

The same type of output occurs whether I use php -h or just plain php
with no arguments.  Looking at /usr/share/magic I've excerpted the
lines as noted:

3848    # HP Printer Job Language
3849    0       string          \033%-12345X@PJL        HP Printer Job Language data
3850    # HP Printer Job Language
3851    # The header found on Win95 HP plot files is the "Silliest Thing
possible" 
3852    # (TM)
3853    # Every driver puts the language at some random position, with
random case
3854    # (LANGUAGE and Language)
3855    # For example the LaserJet 5L driver puts the "PJL ENTER LANGUAGE"
in line 10
3856    # From: Uwe Bonnes <[EMAIL PROTECTED]>
3857    # 
3858    0       string          \033%-12345X@PJL        HP Printer Job Language data
3859    >&0     string          >\0                     %s
3860    >>&0    string          >\0                     %s
3861    >>>&0   string          >\0                     %s  3862        >>>>&0  string 
         >\0                     %s 
3863    #>15    string          \ ENTER\ LANGUAGE\ =
3864    #>31    string          PostScript              PostScript

If I then make distclean and ./configure just as above, but without
--enable-mime-magic everything looks as it should.  Should CLI and
--enable-mime-magic not be used together?  Hopefully this all makes
sense to someone and this message comes out readable.

Thanks,

Hans

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=22275&edit=1

Reply via email to