Fatal error: mime_content_type
Posted Oct 19, 2011 - 7:43 AM:
Fatal error: Call to undefined function mime_content_type() in /home/xxx/public_html/xxx/classes/attachment.php on line 172
Had a recent server move/upgrade by my host. From what I googled & from php.net below, appears this function is no longer supported on my new server. php.net - "This function has been deprecated as the PECL extension Fileinfo provides the same functionality (and more) in a much cleaner way."
Is there a solution other than removing/comment out that part of the code. Also, not sure why - line170 if (functionwillwork('mime_content_type')) is not working as this should of been the solution?
While the function is depreciated, the PHP manual page suggests it should still be present in PHP 5. Yet on some hosts it seems not to be for whatever reason. I see the fileinfo PECL extension is enabled by default for PHP 5.3, but not earlier versions, and many/most are still on PHP 5.2. I will look into adding support for that and having it check if those functions exist though, and hope that test works better than the mime_content_type test. Whether that will help you I don't know -- probably not, I think if you had the fileinfo extension you'd also have the mime_content_type.
The functionwillwork check is supposed to be the solution, yes. Aggravatingly, different hosts have different strange ways of blocking functions. If you could show me a copy of the phpinfo for your host (click view phpinfo on front page wsn admin panel or make a <?php phpinfo(); ?> file) I might be able to determine what they're doing from that, but FTP access would give me the best chance to work it out: http://www.wsnlinks.com/inspection.html
I see the latest wsnlink update today has added support for the finfo_open. Appears both mime_content_type() and finfo_open are both disabled/not installed on my shared server (still on PHP 5.2.17) as I now get the fatal error for undefined function for finfo_open. I opened a ticket with my host to inquire as this is not a bug/issue with wsnlinks, but with what my host has enabled.
Paul, just for topic closure. My host provider replied with the below. With the last update, I believe everything is working without error.
The original mime_content_type() function was removed in recent versions of PHP in favor of the fileinfo PECL module. Open a ticket with support, they should be able to get it installed for you.
Thanks, Rich
0/5
1
2
3
4
5
Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.
Comments on Fatal error: mime_content_type
Member
Usergroup: Customer
Joined: Dec 23, 2009
Total Topics: 8
Total Comments: 19
Posted Oct 19, 2011 - 7:43 AM:
Fatal error: Call to undefined function mime_content_type() in /home/xxx/public_html/xxx/classes/attachment.php on line 172
Had a recent server move/upgrade by my host. From what I googled & from php.net below, appears this function is no longer supported on my new server.
php.net - "This function has been deprecated as the PECL extension Fileinfo provides the same functionality (and more) in a much cleaner way."
Is there a solution other than removing/comment out that part of the code. Also, not sure why - line170 if (functionwillwork('mime_content_type')) is not working as this should of been the solution?
Thanks in advance. - Rich
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
While the function is depreciated, the PHP manual page suggests it should still be present in PHP 5. Yet on some hosts it seems not to be for whatever reason. I see the fileinfo PECL extension is enabled by default for PHP 5.3, but not earlier versions, and many/most are still on PHP 5.2. I will look into adding support for that and having it check if those functions exist though, and hope that test works better than the mime_content_type test. Whether that will help you I don't know -- probably not, I think if you had the fileinfo extension you'd also have the mime_content_type.
The functionwillwork check is supposed to be the solution, yes. Aggravatingly, different hosts have different strange ways of blocking functions. If you could show me a copy of the phpinfo for your host (click view phpinfo on front page wsn admin panel or make a <?php phpinfo(); ?> file) I might be able to determine what they're doing from that, but FTP access would give me the best chance to work it out: http://www.wsnlinks.com/inspection.html
Member
Usergroup: Customer
Joined: Dec 23, 2009
Total Topics: 8
Total Comments: 19
Thanks Paul for the quick reply/update.
I see the latest wsnlink update today has added support for the finfo_open. Appears both mime_content_type() and finfo_open are both disabled/not installed on my shared server (still on PHP 5.2.17) as I now get the fatal error for undefined function for finfo_open. I opened a ticket with my host to inquire as this is not a bug/issue with wsnlinks, but with what my host has enabled.
I'll update once they respond. Thanks -Rich
Member
Usergroup: Customer
Joined: Dec 23, 2009
Total Topics: 8
Total Comments: 19
Paul, just for topic closure. My host provider replied with the below. With the last update, I believe everything is working without error.
Thanks, Rich