If you encounter the following problems:
Fatal error:Call to undefined function mysqli_connect() in xxxxxx
Turn on module support, that is, remove the semicolon in front of extension=php_mysqli.dll
Modify the extension_dir in php.ini to the correct directory, such as extension_dir = "/usr/src/php-5.4.19/ext"
phpinfo();
If there is no mysli module, you have to add the extension file of mysqli yourself
The steps to install mysqli are recorded here:
First go to the php installation package, there is a file named ext below
cd ext
cd mysqli
Next, you need to use phpize (phpize is used to extend the php extension module, through phpize, you can build a php plug-in module, there are detailed explanations on the Internet, you can go to Du Niang if you are interested).
Directly enter phpize as shown in the figure:
If this does not work, you can use: find / -name phpize command to check the location of phpize, as shown in the figure:
, and then use /usr/local/bin/phpize, as shown in the figure:
Next, use this:
./configure -prefix=/usr/local/mysqli
make
make install
These three commands will generate a directory file after using make install, as shown in the figure:
Use ls to view the directory and you can see that there will be a file mysqli.so ending in .so, which is equivalent to the .dll file under windows , as shown in the figure:
Another important thing not to forget is to add the generated mysqli.so file to the php.ini configuration.
Edit php.ini with vi /usr/local/lib/php.ini,
Add at the end: extension = /usr/local/lib/php/extensions/no-debug-non-zts-20100525/mysqli.so as shown in the figure:
Finally use: service mysqld restart command to restart the service and it will be OK!
Use phpinfo(); in the program to see the content of the mysqli extension:
The error I'm getting:
configure: error: Cannot find PHP-config. Please use --with-php-config=PATH
Generally, this error shows that when you execute ./configure, the --with-php-config parameter configuration path is wrong or not caused. plus
./configure -prefix=/usr/local/mysqli \
--with-php-config=/usr/local/fastphp/bin/php-config