PHP finfo

software development

#1

I’m trying to use finfo in my site’s php programs. I’ve selected PHP 5.3.x Fast CGI for my PHP mode.

When I try to call finfo_open() I get the following error:

Similarly, I get an error when I try to instantiate a new object using:

[php]$finfo = new finfo(FILEINFO_MIME_TYPE);[/php]

I thought finfo was built-in for PHP 5.3.x

–ejb


#2

Nope! It has to be loaded as an extension.


#3

I guess I misinterpreted the statement in the manual: “This extension is enabled by default as of PHP 5.3.0”

I did a phpinfo() and see this in the Configure Command:

‘–enable-fileinfo=shared’

Does this mean that this module should be loaded, or does it just mean that it is “available” to be loaded? If the latter, how do I load it?

Thanks!


#4

See DreamHost Wiki - PHP.ini - PHP 5.3


#5

@atropos7 – thanks!

I followed the instructions and created the file: ~/.php/5.3

In it I placed the following line:

Seems to work!


#6

Any other tips are appreciated.

I followed the steps by creating phprc file in ~/.php/5.3 directory that contain a single line of characters:
extension = fileinfo.so

I continue to get Fatal error: Call to undefined function finfo_open() errors.

I am running version 5.3.13 of PHP with Fast CGI enabled.

Thanks,
PTay


#7

Do you get any error messages besides “could not open input file: test” if you try running this command in a shell?


#8

According to the Dreamhost panel, I was running “PHP 5.3.xFASTCGI”

but when I entered in the terminal

“php -v”

It said I was running 5.2.17.

Um…

Just switched my domain to “PHP 5.4.x…”

So maybe in a few minutes I’ll actually be running PHP 5.3.something


#9

The command prompt will always use 5.2.17, to change that you need to specify which php you want such as

/usr/local/php53/bin/php

the php setting in the panel will effect which php apache sees.