Recently I uploaded my file on live server and facing this error shown below but everything is working good on my local server.
Fatal error: Class 'finfo' not found in plugins/doc management/view/add_doc.php on line 71 The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.
Code
$file = file_get_contents($url);
$filesize = strlen($file);
$file_info = new finfo(FILEINFO_MIME_TYPE);
$mime_type = $file_info->buffer(file_get_contents($file));
if(in_array($extension, $allowedExts)){
chmod(ABSPATH.'/wp-content/uploads/2019/07/',0777);
$upload = file_put_contents(ABSPATH.'/wp-content/uploads/2019/07/'.$name,$file);
What I have tried so far to get rid of this error.
tried to enabled fileinfo via .htaccess file but getting 500 internal server error page is not working after doing that. I tried to add them in the end of the .htaccess file
php_value extension=php_fileinfo.dll
or
php_admin_flag extension=php_fileinfo.dll
Solution2: I tried to add ini_set('extension', 'php_fileinfo.so');
to enable fileinfo but stil getting the same error after adding it.
solution 3: I tried to create a php.ini file in the root folder of the public HTML page to override the php.ini file with mine but it still won't work out getting the same error.
my WordPress site is inside a subfolder of the public_html directory. there is html index.html page on the root as a landing page.
I don't know how to check that it is enabled or not. I create info.php file and added phpinfo() function to see the PHP details it is showing but I don't know what finfo is there how to find it. tried to search out but won't work.
I am having Cpanel access tried but not working out. the ways I tried and I am having PHP 5.6 which is greater than PHP 5.3
I checked out phpinfo(); and in configuration, it is showing...
--enable-fileinfo=shared'
but still, I am getting the same error.
on my localhost when I use phpinfo() it shows that fileinfo is enabled. but on the server phpinfo() is not showing that fileinfo is availabe.