mysqli extension missing (Windows 10, PHP 7.17, MAMP,) - php

So I have been searching high and low an answer to my problem. Anytime I go here
http://localhost:8888/phpMyAdmin/, I get this error
So I created a php file with phpinfo() and get this
info.php
So then I go to my file explorer and follow the directory
C:\MAMP\conf\php7.1.7
Loaded Configuration File C:\MAMP\conf\php7.1.7\php.ini
Next I opened the php.ini file in sublime to make some changes (C:\MAMP\conf\php7.1.7\php.ini). I believe all the extensions are located at this directory
C:\MAMP\bin\php\php7.1.7\ext
where I think the php extensions are located at
So these are the changes I make to my php.ini file (removing the ; from the front)
1) ;Directory in which the loadable extensions (modules) reside.
extension_dir = "C:\MAMP\bin\php\php7.1.7\ext\"
2) ; Dynamic Extensions.
extension=php_mysqli.dll
I restart my MAMP server every time I make a change and reset my browser as well. And I still get the same "mysqli extension" missing error
I have even tried adding some environment variable paths.....
added two different environment variables
C:\MAMP\conf\php7.1.7
and
C:\MAMP\conf\php7.1.7\php.ini
Also here is my new_connection.php file and code to connect to MySql
new_connection.php
This is what I get when I run the code (showing that both If statements are failing)
mysqli_init function does not exist,
mysqli extension is not loaded
I found this
https://secure.php.net/manual/en/mysqli.installation.php
which states....
PHP 5.3.0 and newer
On Windows, for PHP versions 5.3 and newer, the mysqli extension is enabled and uses the MySQL Native Driver by default. This means you don't need to worry about configuring access to libmysql.dll.
Which confuses me, because the mysqli extension did have a ';' in front when I opened the php.ini file

I used MAMP with PHP version 8.0.1 and the phpMyAdmin-Page always said that it needs mysqli to work. I searched every folder, commented a lot, always refreshed the server and so on but nothing worked...
... until I changed the PHP version to version 8.1.0 in the MAMP-settings and the extension_dir in the php.ini (path should be something like \MAMP\conf\php8.0.1) (the "extension_dir" should be in line 544).

Related

CURL extension needs to be loaded - Opencart on WAMP 3.0.0

I have been trying to install opencart 2.1.0.2 on WAMP 3.0.0 but I keep getting the error message "Warning: CURL extension needs to be loaded for OpenCart to work! ", When I navigate to C:\wamp64\bin\php I notice there are two php folders here php5.6.16 and php7.0.0, although on my localhost page it says that the current php setting is php5.6.16. I did a CURL search inside my php.ini file (in the php5.6.16 folder) and I found the following string of codes
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) 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=php_bz2.dll
extension=php_curl.dll
I need some help here, how do I turn on / load CURL?
Sometimes there are several php.ini files. You need to find the one that is loaded at run time.
Create a new PHP file and echo your loaded PHP configuration: echo phpinfo();
Search if you can find a section dedicated for CURL.
If not, find the section Loaded Configuration Fileto see which php.ini file is being loaded.
Add extension=php_curl.dllto the loaded php.ini file.
Restart Apache.
Using the WAMPServer menus is the easiest way and ensured that you amend the correct php.ini file as there are 2 versions, one for Apache/PHP and one for PHP CLI. It will also make sure you amend the correct php.ini file for the version of PHP that is actually active when you make the amendment, remember WAMPServer can have multiple versions of Apache & PHP and MYSQL sitting on the system, but only one of each active.
(left click) wampmanager -> PHP -> PHP Extensions -> php_curl
Also if you are using a https address in your curl you will likely need to also include php_openssl
(left click) wampmanager -> PHP -> PHP Extensions -> php_openssl
If these items have a TICK beside them then they are already activated, if no tick then click the menu item, the php.ini file will automatically be amended and Apache restarted. You will see the wampmanager icon go Orange and then Green again when the amendment is complete and Apache restarted.

Extensions shown in phpinfo() don't match with those enabled in loaded php.ini

I use EnterpriseDB ApachePHP on Windows XP (32 bit). I tried to enable some extensions in php.ini in the directory with ApachePHP, but nothing changed. Then I found that phpinfo() not just doesn't show the extensions I uncommented in php.ini, but it also shows others that I didn't uncomment. I have several other php.ini files on my computer, but phpinfo() shows the correct path to the php.ini file as "Loaded Configuration File" (D:\Programy\EDB_Apache\php\php.ini - that the path to the php.ini file I use; plus it shows its copy in C:\WINDOWS in "Configuration File (php.ini) Path").
The configuration must be overriden by something in ApachePHP - pgsql and pdo_pgsql are among the commented but shown libraries, while all my other php.ini instances have only MySQL and SQLite enabled. On the other hand, even the extensions contained in D:\Programy\EDB_Apache\php\Sdk\include\ext (D:\Programy\EDB_Apache is ApachePHP root) don't match those shown in phpinfo(), so it might be even more difficult.
So how to find and edit the configuration that is shown in my phpinfo(), or how to solve the bug causing it not to correspond to the loaded php.ini file? Please don't tell me to restart Apache or my computer (I configure localhost), I did this many times, even just before asking this question.
EDIT: Once again, I'm absolutely sure the path shown in phpinfo() as "Loaded Configuration File" matches to the path of the php.ini file I use. Even if the path shown there was not correct (which would be a matter of a question - how is it possible, and how to correct it?), no one of php.ini files on my computer matches the configuration shown by phpinfo. I have searched for any instance of php.ini, so I'm sure I didn't miss any of them, even if it was a hidden/system file.
EDIT2: reinstall of EDB ApachePHP didn't help. I changed the paths slightly during the reinstall, so I updated paths here. "Loaded Configuration File" path still matches the right configuration file, and I keep restarting Apache after every change.
I looked closer to phpinfo(), especially to "Configure Command":
cscript /nologo configure.js "--enable-cli" "--enable-cgi"
"--with-openssl" "--enable-pdo"
"--with-extra-includes=C:\pgBuild32\include;D:\pginstaller_2.auto-repo\output\include;D:\pginstaller_2.auto-repo\apache.staging\include"
"--with-extra-libs=C:\pgBuild32\lib;D:\pginstaller_2.auto-repo\output\lib;D:\pginstaller_2.auto-repo\apache.staging\lib" "--enable-apache2filter" "--enable-apache2-2filter"
"--enable-apache2handler" "--enable-apache2-4handler"
"--with-apache-hooks" "--with-pgsql" "--with-pdo-pgsql"
"--with-prefix=D:\pginstaller_2.auto-repo\php.staging"
"--enable-one-shot" "--enable-cli-win32" "--enable-embed"
"--enable-isapi" "--enable-ftp" "--without-mysqlnd"
"--with-xsl=SHARED" "--enable-mbstring" "--enable-mbregex"
"--enable-shmop" "--enable-exif" "--enable-soap" "--enable-sockets"
"--with-gd=SHARED" "--without-mysql" "--without-mysqli"
"--without-sqlite3" "--without-pdo-mysql" "--without-pdo-sqlite"
Paths listed there (C:\\pgBuild32\include, D:\\pginstaller_2.auto-repo\output\lib etc.) don't exist on my computer. Their existence seems to confirm my assumption that parts of the setting are overwritten by some EnterpriseDB default (or that configuration in php.ini somehow doesn't work, so the defaults are applied). I don't know where are these settings saved - that's the point of this question, if I knew, I would change them and celebrate.
There is another possible cause of the problem: lack of dll's. Most php distributions have them in ./ext. In EnterpriseDB "php" directory has only one subdirectory, and it is named "Sdk"; the extensions are (or should be; there are no dll files in that dir) in D:\Programy\EDB_Apache\php\Sdk\include\ext directory. This directory contains only .h files (in directories named after the extensions), no dll. If this is not the ordinary architecture for EnterpriseDB bundle, please tell me; I might have a bad installer file.
So I first copied the dll's from another php installation (I didn't manage to get exactly those for PHP 5.4.23, but they are 5.4 too) into the extension folder, but nothing changed. Then I even copied whole ext folder to php directory in the ApachePHP bundle location and changed the extension path to it - again, no change.
For testing reasons, I tried to run php.exe. It returned a warning:
PHP Warning: PHP Startup: gd: Unable to initialize module
Module compiled with build ID=API2010025,TS,VC9
PHP compiled with build ID=API2010025,TS,VC10
These options need to match
in Unknown on line 0
So if I want to substitute dll's, I need to find either VC9 ApachePHP (will it still support PostgreSQL 9.3? My main reason for all this is to be able to created forms for my database), or VC10 PHP 5.4. I didn't find any .msi installer for PHP 5.4 (even less VC10 one) and after some bad experiences with software installation through command line on Windows I don't want to try non-msi version without being sure that this is the only choice.
Any advice now?

Add MsSQL via PHP INI

I just uploaded and overwrote the old php.ini with a new one that was blank and now all my mssql_connect() functions are not working.
What is the commange to enable this again?
Remove the semi-colons ; before the modules for mssql.
Search for ;extension=php_mssql.dll in your php.ini and remove the ; at the beginning. After this, restart the Apache service.
To my knowledge, you'll have to assemble a new php.ini. You can go to http://php.net/downloads.php and download PHP as if you were going to install it. There are at least two version there to start with.
In php for windows are a precomiped php_mssql.dll, in unix/linux you can use mssql module via freetds library, some distributions have compiled it if not you have to compile it manually. if you have doubts about compile ask it in comments.
To enable or disable modules in php ini search the extension keys you look something like
In Unix/Lin:ux
extension=mssql.so
In windows
extension=php_mssql.dll
disabled means the line is not present, or can be commented with a semicolon ; at first.
The PHP distribution on most platforms ships with sample php.ini files named php.ini-development and php.ini-production. If you copy whichever one of these files is most suitable for your environment to php.ini, you will at least be in a known good state.

After I configure my php.ini file to load the MySQL module, it doesn't appear in phpinfo() and I can't call to MySQL functions

sorry if this is a really silly question. I googled a lot and nothing came up
I have this in my php.ini file:
extension_dir="C:\Program Files\PHP\ext"
enable_dl = on
extension=php_mysql.dll
when I call the phpinfo() function it says that there aren't any loaded modules.
I am using the latest version of apache, php and MySQL in a windows operating systems.
Also, I have used a WAMP server but I prefer having things separately and I want to learn how to do it
Thanks in advance
You need to enable the mysql extension itself in php.ini too. For example if you want to use mysqli, you need to add this to your php.ini file:
extension=php_mysqli.dll
also make sure that you have this dll file in your ext directory.

Using php_fileinfo.dll and finfo_open in Windows PHP 5.3.5

I'm having trouble calling finfo_open in a PHP script running on Windows Server 2003 with PHP 5.3.5 & IIS 6. The call always returns Fatal error: Call to undefined function finfo_open() in...
Through a little reading I know that fileinfo functionality is not included by default in the windows PHP installation, though nothing I try gets it working. The instructions in comment #3 here: http://www.php.net/manual/en/fileinfo.installation.php didn't help, and that's the most official looking explanation I can find. There's lots of information about needing the mime_magic dll on the web but it seems like this is no longer required as of 5.3. Furthermore, I have read on http://pecl.php.net/package/Fileinfo that "As of PHP 5.3.0 this extension is enabled by default". What's going on?
This issue is on a testing server. On my local machine I have xampp and PHP 5.3.1 and the call works fine, so I also tried copying the php_fileinfo.dll from local to php\ext on testing but this also didn't make any difference (I know that versions are different, but I read that the 5.3 is the important bit).
Any advice on this would be much appreciated!
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $filepath);
You're already close to get it done, only some little configuration is missing on your end.
Please see the fileinfo usage and installation instructions:
Windows users must include the bundled php_fileinfo.dll DLL file in php.ini to enable this extension.
That DLL file is bundeled with PHP 5.3.6 for example, you can find the files here: PHP For Windows - Binaries and sources Releases. It should be already located in the ext subdirectory of your PHP installation. If not download it again from the said website (choose your PHP version) and place it into the extension directory.
You need to add the following line your php.ini then to activate it:
extension=php_fileinfo.dll
That's the standard procedure to activate a PHP extension under windows. You can find more information about how to actiave a PHP extension here: Installation of extensions on Windows. If you have problems to locate the php.ini file, please refer to the PHP installation instructions - Installation on Windows systems.
This line
extension=php_fileinfo.dll
was commented in my php.ini so I uncommented it and then restarted my xampp server.
After doing what hakre suggested, the FileInfo extension was still not loaded at my end, but then eventually I solved it by figuring out that the php.ini file I was modifying was the wrong one (that was located at \MAMP\bin\php\php7.2.10) whereas the correct one was located at \MAMP\conf\php7.2.10.
After enabling it in the correct ini file, I had to restart the php server and off it worked.
NOTE: You might have to replace '\MAMP' from the start of the path with the path where your web-server solution stack software (e.g. MAMP, WAMP, XAMP or else) is installed. Since I was using MAMP that's why its present in my file path

Categories