Whenever I try to get the mime content type from php, it echos:
Fatal error: Class 'finfo' not found in /home/jobynadel/finadel.com/video/finfo.php on line 4
or
Fatal error: Call to undefined function finfo_open in /home/jobynadel/finadel.com/video/finfo.php on line 4
I just can't figure it out!
The code I am using is:
$file_info = new finfo(FILEINFO_MIME_TYPE);
// See constant value http://php.net/manual/en/fileinfo.constants.php#113687
$mime_type = $file_info->buffer(file_get_contents($file));
Have a look at your php.ini file and check that the fileinfo.soor php_fileinfo.dll is activated (depending on your platform and version).
There should be a line similar to
extension=fileinfo.so
in your php.ini file
If you using XAMPP, you enable extension=php_fileinfo.dll in php.ini
What version of PHP do you have? PHP 5.3.0 and later have Fileinfo built in, but on Windows you must enable it manually in your php.ini. You can find further information in the documentation.
If you are using WAMP then Go to PHP extensions and enbale PHP_fileinfo and restart all serverices.
Windows users: just edit php.ini and uncomment this line:
extension=php_fileinfo.dll
I.e. remove the preceding semicolon from
;extension=php_fileinfo.dll
Remember to restart Apache for new php.ini to take effect.
For those have had it working fine, but then this error appears:
Some hosting providers (e.g., Dreamhost) allow customers to override default PHP settings in a configuration file, often with a path something like:
~/.php/5.4/phprc
That version number in the path can be a problem if you upgrade PHP (or it is upgraded on your behalf). Any custom settings from the prior version, including one enabling the fileinfo extension, will be missing in the newer version. Usually you can just copy the config file to the appropriate new config directory and restart the server.
I had this same issue with PHP.I did the following steps:
- make sure that the fileinfo extension is already installed if you are using < PHP 5.3.0.
- Then you have to add in php.ini ;extension=fileinfo.so or
;extension=php_fileinfo.dll
- If you want to uncomment remove the semicolon(;)
extension=fileinfo.so or extension=php_fileinfo.dll
Then save and restart your web server.
For PHP 7.3 or Higher
Change
;extension=fileinfo
To
extension=fileinfo
in php.ini file.
Related
Whenever I try to get the mime content type from php, it echos:
Fatal error: Class 'finfo' not found in /home/jobynadel/finadel.com/video/finfo.php on line 4
or
Fatal error: Call to undefined function finfo_open in /home/jobynadel/finadel.com/video/finfo.php on line 4
I just can't figure it out!
The code I am using is:
$file_info = new finfo(FILEINFO_MIME_TYPE);
// See constant value http://php.net/manual/en/fileinfo.constants.php#113687
$mime_type = $file_info->buffer(file_get_contents($file));
Have a look at your php.ini file and check that the fileinfo.soor php_fileinfo.dll is activated (depending on your platform and version).
There should be a line similar to
extension=fileinfo.so
in your php.ini file
If you using XAMPP, you enable extension=php_fileinfo.dll in php.ini
What version of PHP do you have? PHP 5.3.0 and later have Fileinfo built in, but on Windows you must enable it manually in your php.ini. You can find further information in the documentation.
If you are using WAMP then Go to PHP extensions and enbale PHP_fileinfo and restart all serverices.
Windows users: just edit php.ini and uncomment this line:
extension=php_fileinfo.dll
I.e. remove the preceding semicolon from
;extension=php_fileinfo.dll
Remember to restart Apache for new php.ini to take effect.
For those have had it working fine, but then this error appears:
Some hosting providers (e.g., Dreamhost) allow customers to override default PHP settings in a configuration file, often with a path something like:
~/.php/5.4/phprc
That version number in the path can be a problem if you upgrade PHP (or it is upgraded on your behalf). Any custom settings from the prior version, including one enabling the fileinfo extension, will be missing in the newer version. Usually you can just copy the config file to the appropriate new config directory and restart the server.
I had this same issue with PHP.I did the following steps:
- make sure that the fileinfo extension is already installed if you are using < PHP 5.3.0.
- Then you have to add in php.ini ;extension=fileinfo.so or
;extension=php_fileinfo.dll
- If you want to uncomment remove the semicolon(;)
extension=fileinfo.so or extension=php_fileinfo.dll
Then save and restart your web server.
For PHP 7.3 or Higher
Change
;extension=fileinfo
To
extension=fileinfo
in php.ini file.
I know there's tons of topics about my problem, but I can't find a solution.
I'm using wamp and I've changed my version of PHP from 5.5.12 to 5.6.16, then when I go to localhost/phpmyadmin i have this error displayed :
Fatal error: Call to undefined function mb_detect_encoding() in
C:\wamp\apps\phpmyadmin4.1.14\libraries\php-gettext\gettext.inc on
line 177
So I update phpMyAdmin from 4.1.14 to 4.5.2.
And I have this **** error:
phpMyAdmin - Error The mbstring extension is missing. Please check
your PHP configuration.
My php.ini, phpForApache.ini is configured, I have un-commented the extension, set extension_dir to C:\wamp\bin\php\php5.6.16\ext, I stumbled on many topics/forum but none of the solution works.
Do you have any idea?
Please check #36254548
Copying the php.ini file to "wamp64\bin\apache\apache2.4.17\bin" has solved my problem.
Sometimes the extensions directory is well pointed to, the dll files have been uncommented but it still doesn't work.
The next solution to use, that is if your extensions directory is correct and dll files for the mbstring has been uncommented, then copy the php.ini file and paste it into the windows directory (i.e. C:\Windows).
You then restart your wamp/xampp and it will work.
check your php.ini file. In the extensions part of the configuration you should find:
;extension=php_mbstring.dll
remove the leading ';' to uncomment and enable the extension so it looks like this:
extension=php_mbstring.dll
restart your apache and it should work.
I faced the same issue when I start wamp, suddenly my project was not working and when I check the phpmyadmin, it gives the same above error.
My debugging process found php.ini file is missing. However I already installed two PHP versions, 5.6.19 and 7.0.4. I changed the version to 7.0.4 and then re-changed to 5.6.19. It started work.
What I guess, while changing the version, all the configuration files getting re-installed in wamp folder.
For some reason the ftp_connect() function doesn't work, when I try to used it it ends with a fatal error stating that this function is undefined... Surprisingly I can still use a ftp client or use an ftp connection through the Terminal. How may I solve this problem ?
I run on Mountain Lion et I've got the 5.3 php version - I reinstalled it once hoping this would solve my problem.
Check PHP FTP installation manual
On PHP 7, You can enable it by adding this line to the php.ini file.
extension=php_ftp.dll
On PHP 8+ enable this line in php.ini:
extension=ftp
I ran into the same issue. After I checked this one setting, it worked just fine.
Sounds like your PHP was not installed with --enable-ftp or that the ftp module is disabled in your php.ini.
To check if ftp is enabled, create a page like this and browse to it:
<?php
phpinfo();
?>
Look for "ftp support", it should be marked "enabled".
I found that (at least for higher versions of PHP), that Luboš Turek's answer is mostly correct. On Windows, at least, you don't need (or want) the ".dll" suffix.
What is very odd is that the PHP.INI default configuration file doesn't even include a commented out line stating:
;extension=php_ftp
So, as Luboš said, adding:
extension=php_ftp
to the INI will work. That said, check your ext folder to make sure the FTP extension is there.
I came here looking for an answer and fixed mine by changing the setting in php.ini as below. I removed the leading semicolon on the ftp extension line (at the bottom).
; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
; extension folders as well as the separate PECL DLL download (PHP 5+).
; Be sure to appropriately set the extension_dir directive.
;
extension=bz2
extension=curl
;extension=dba
extension=com_dotnet
;extension=enchant
extension=fileinfo
extension=ftp
Guys I find the Solution, For me I had PHP 5 and now I have PHP 7. I get this error. Do this:
Open PHP.INI
Search for : allow_url_include = Off
Change Off to ON:
Like this: allow_url_include = On
Restart all Service on Wamp server
I had the same problem, i fix it disabling the antivirus or add the apache server to the exception.
I spent three hours but I did not find anything; I'm unable to connect to a SSL enabled server. I want to list what i did:
First checked my PHP extensions directory was in order; extension wasn't there, php_openssl.dll
Then I opened my php.ini file but I could not see any extension=php_openssl.dll line to uncomment.
Also, I searched on Google and saw people with the same problem.
http://www.apachefriends.org/f/viewtopic.php?p=162623
However, I also have
OPENSSL_CONF C:/xampp/apache/bin/openssl.cnf
...
openssl
OpenSSL support enabled
OpenSSL Library Version OpenSSL 0.9.8l 5 Nov 2009
OpenSSL Header Version OpenSSL 0.9.8l 5 Nov 2009
no lines . What should I do? Please share your suggestions.
Yes, you must open php.ini and remove the semicolon to:
;extension=php_openssl.dll
If you don't have that line, check that you have the file (In my PC is on D:\xampp\php\ext) and add this to php.ini in the "Dynamic Extensions" section:
extension=php_openssl.dll
[PHP_OPENSSL]
extension=php_openssl.dll
This is the answer.
Things have changed for PHP > 7. This is what i had to do for PHP 7.2.
Step: 1: Uncomment extension=openssl
Step: 2: Uncomment extension_dir = "ext"
Step: 3: Restart xampp.
Done.
Explanation: ( From php.ini )
If you wish to have an extension loaded automatically, use the following syntax:
extension=modulename
Note : The syntax used in previous PHP versions (extension=<ext>.so and extension='php_<ext>.dll) is supported for legacy reasons and may be deprecated in a future PHP major version. So, when it is possible, please move to the new (extension=<ext>) syntax.
Special Note: Be sure to appropriately set the extension_dir directive.
So, what did we do to make openssl_pkey_new() and all the other openssl_ functions in PHP work...
Enabled the extension php_openssl.dll in the (right/active) php.ini. Checked.
Checked that there exists a openssl.cnf in xampp\apache\conf\ (and also in two other directories within XAMPP). Checked.
Added the environment variable OPENSSL_CONF in the Windows system settings with the full path to the above openssl.cnf. Checked.
Restarted Apache (and after that did not work restarted the computer several times...). Checked.
Still does not work, and throwing errors such as
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:02001002:system library:fopen:No such file or directory
error:2006D080:BIO routines:BIO_new_file:no such file
Okay, here are another two more things to check.
1. Trouble with the environment
Run phpinfo() from a PHP script, and go to the "Apache Environment" section. Check the value of OPENSSL_CONF.
Surprise. This is not what we have set in the windows system settings.
The solution is simple. Set the environment variable in the PHP script.
putenv('OPENSSL_CONF=C:\xampp\apache\conf\openssl.cnf');
2. Trouble with relative filenames
Now, openssl_pkey_new() will work, but openssl_pkey_export_to_file() does still not work and returns false without any further explanation?
Check the filename that you have specified as output filename. It will not work in Windows as long as you do not specify the full path.
$folder = realpath('../keyring');
$outfile = $folder.'/private.pem';
openssl_pkey_export_to_file($key, $outfile);
I use xampp. Beforehand I tried the example file "test_smtp_gmail_basic.php" in phpMailer (you can download phpMailer here: https://github.com/Synchro/PHPMailer), but I got the following error:
Mailer Error: The following From address failed: xxx#gmail.com
After I commented out ; extension=php_openssl.dll in php.ini, it is working now.
In xampp, if "extension=php_openssl.dll" is not present in your php.ini file then add it in the "Windows Extensions" section of your php.ini file
and restart your apache.
It works for me..
You will need to edit your php.ini. It's 4 easy steps.
Find your php.ini file.
$inipath = php_ini_loaded_file();
Enable openssl in the file:
extension=php_openssl.dll
Turn allow_url_fopen on
allow_url_fopen = On
Restart apache and you are done!
STEP 1: On your php.ini comment out ;extension=php_openssl.dll
STEP 2: Copy libeay32.dll and ssleay32.dll from your PHP root folder and paste it your Apache/bin folder
STEP 3: Restart Apache
I am assuming that this question is for those using a windows based system.
After making sure that the extension extension=php_openssl.dll in your php.ini file does not have a semicolon.
Then make sure that you have added C:/xampp/apache/bin into your environment path in order to use openssl without having move the command prompt to that directory C:/xampp/apache/bin
Although not related to this question but as the WP migrate Pro docs link to this question I though I would post an answer here.
If your having problems with DB Migrate Pro activating instead of enabling SSL you can just add a line of code to your wp-config
define( 'WPMDB_LICENCE', 'XXXXXXXXXXx' );
Whenever I try to get the mime content type from php, it echos:
Fatal error: Class 'finfo' not found in /home/jobynadel/finadel.com/video/finfo.php on line 4
or
Fatal error: Call to undefined function finfo_open in /home/jobynadel/finadel.com/video/finfo.php on line 4
I just can't figure it out!
The code I am using is:
$file_info = new finfo(FILEINFO_MIME_TYPE);
// See constant value http://php.net/manual/en/fileinfo.constants.php#113687
$mime_type = $file_info->buffer(file_get_contents($file));
Have a look at your php.ini file and check that the fileinfo.soor php_fileinfo.dll is activated (depending on your platform and version).
There should be a line similar to
extension=fileinfo.so
in your php.ini file
If you using XAMPP, you enable extension=php_fileinfo.dll in php.ini
What version of PHP do you have? PHP 5.3.0 and later have Fileinfo built in, but on Windows you must enable it manually in your php.ini. You can find further information in the documentation.
If you are using WAMP then Go to PHP extensions and enbale PHP_fileinfo and restart all serverices.
Windows users: just edit php.ini and uncomment this line:
extension=php_fileinfo.dll
I.e. remove the preceding semicolon from
;extension=php_fileinfo.dll
Remember to restart Apache for new php.ini to take effect.
For those have had it working fine, but then this error appears:
Some hosting providers (e.g., Dreamhost) allow customers to override default PHP settings in a configuration file, often with a path something like:
~/.php/5.4/phprc
That version number in the path can be a problem if you upgrade PHP (or it is upgraded on your behalf). Any custom settings from the prior version, including one enabling the fileinfo extension, will be missing in the newer version. Usually you can just copy the config file to the appropriate new config directory and restart the server.
I had this same issue with PHP.I did the following steps:
- make sure that the fileinfo extension is already installed if you are using < PHP 5.3.0.
- Then you have to add in php.ini ;extension=fileinfo.so or
;extension=php_fileinfo.dll
- If you want to uncomment remove the semicolon(;)
extension=fileinfo.so or extension=php_fileinfo.dll
Then save and restart your web server.
For PHP 7.3 or Higher
Change
;extension=fileinfo
To
extension=fileinfo
in php.ini file.