Re: Problems with pear

From: Date: Mon, 14 Jun 2010 18:08:41 +0000
Subject: Re: Problems with pear
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30617@lists.php.net to get a copy of this message
On Mon, 2010-06-14 at 08:48 -0400, David Altman wrote: > I recently was told I could use your MIME_Type-1.2.0 to *properly *detect a > file's mime type. I downloaded that and the pear file, and copied them both > into my scripts directory. I copied the sample line from your site ( > > http://pear.php.net/manual/en/package.tools.mime-type.detecting.php) > as > follows: > > require_once 'MIME/Type.php'; > $filename = '/path/to/some/file.jpg'; > echo MIME_Type::autoDetect($filename); > and changed it to: > > require_once 'MIME_Type-1.2'; > $filename = '/path/to/some/file.jpg'; > echo MIME_Type::autoDetect($filename); > However, I get the following: > > *Warning*: require_once(MIME_Type-1.2) > > [function.require-once<http://www.therefugechurch.info/Scripts/function.require-once>]: > failed to open stream: No such file or directory... > *Fatal error*: require_once() > > [function.require<http://www.therefugechurch.info/Scripts/function.require>]: > Failed opening required 'MIME_Type-1.2' (include_path='.;C:\php5\pear')... > > 1). Both the file MIME_Type-1.2 and PEAR-1.9.1 have no file extensions. > The "Type.php" doesn't exist, unless it's MIME_Type-1.2. > 2). I have no access to my php5.ini file. > > Am I missing something obvious? All I want is the darned MIME type... this > shouldn't be so hard... Can anyone help? Hi David, The correct way to install PEAR packages is via the PEAR installer [1]. The PEAR installer will pull in package dependencies and perform any post-install required tasks such as updating replacement markers or renaming files. If you manually install PEAR packages by extracting the archive, your mileage will vary. Quickly looking at the code you posted, it seems you are requiring the wrong file after extracting the archive. You are trying the require a PHP file named 'MIME_Type-1.2' which does not exist. You probably want 'MIME_Type-1.2.0/MIME/Type.php'. Be advised that this will *still* probably not work unless you use the PEAR installer to install the PEAR package. [1] http://pear.php.net/manual/en/guide.users.commandline.installing.php Cheers, Mike

« previous php.pear.general (#30617) next »