Php extensions to be installed mysqli

How to enable MySQLi extension on web-server

How to enable MySQLi? Before going to enable it on the server, I will share some ideas about MySQLi. Then, I should explain how we can enable MySQLi on a cpanel server and How we can check if MySQLi is already enabled or not in the server.

What is MySQLi?

Simply it’s a MySQL extension for PHP programming language. The MySQLi Extension (MySQL Improved) is a relational database driver used in the PHP programming language to provide an interface with MySQL databases.

The developers of the PHP programming language recommend using MySQLi when dealing with MySQL server versions 4.1.3 and newer (takes advantage of new functionality). The MySQLi extension has a lot of benefits, some of them are listed below:

  • An object-oriented interface
  • Support for prepared statements
  • Support for multiple statements
  • Support for transactions
  • Enhanced debugging support
  • Embedded server support
  • Powerful Functionality
Читайте также:  Parameterized java types of

How to check the MySQLi extension is enabled or not on server?

You can check the MySQLi extension from command line itself by executing the following command.

# php -m | grep mysql 

how to enable MySQLi extension on web-server with cPanel?

EasyApache 3

We can simply enable the MySQLi extension by rebuilding the web-server with Easyapache script. It is very simple, just run the below pasted scripts from the command line as root user, and select the MySQLi from the extension list. See the attached image for more details:

# /scripts/easyapache 

How to enable MySQLi

EasyApache 4

You can directly enable it from the WHM panel. Please do the following steps to enable it.

Step 1 : Log into WHM panel.

Step 2 : Go to Home » Software » EasyApache 4

Step 3 : Click on “Customize

How to enable MySQLi

Step 4 : Go to PHP Extensions

How to enable MySQLi

Accessing PhpMyAdmin without cPanel login?

This article will help you to access databases of cPanel users’ without accessing the cPanel account.

Consider the scenario, you’ve a cPanel account and you want to share the details of a database (DB) with one of your we site developers and actually you do not want to share the cPanel credentials.

In EasyApache 4, the mysqli extension is provided by the mysqlnd package. To illustrate this, here is a list of the files that are provided by the ea-php55-php-mysqlnd package.

# rpm -ql ea-php55-php-mysqlnd /opt/cpanel/ea-php55/root/etc/php.d/mysqlnd.ini /opt/cpanel/ea-php55/root/etc/php.d/mysqlnd_mysql.ini /opt/cpanel/ea-php55/root/etc/php.d/mysqlnd_mysqli.ini /opt/cpanel/ea-php55/root/etc/php.d/pdo_mysqlnd.ini /opt/cpanel/ea-php55/root/usr/lib64/php/modules/mysqlnd.so /opt/cpanel/ea-php55/root/usr/lib64/php/modules/mysqlnd_mysql.so /opt/cpanel/ea-php55/root/usr/lib64/php/modules/mysqlnd_mysqli.so /opt/cpanel/ea-php55/root/usr/lib64/php/modules/pdo_mysqlnd.so 

how to enable MySQLi extension on web-server without cPanel?

In a server without cPanel, you need to compile the MySQL with the MySQLi extension.

# ./configure --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config 

How to check the MySQLi extension is enabled on server?

# php -m|grep mysql mysql mysqli 

Related links:

Источник

Php extensions to be installed mysqli

The mysqli extension was introduced with PHP version 5.0.0. The MySQL Native Driver was included in PHP version 5.3.0.

Installation on Linux

The common Unix distributions include binary versions of PHP that can be installed. Although these binary versions are typically built with support for the MySQL extensions, the extension libraries themselves may need to be installed using an additional package. Check the package manager that comes with your chosen distribution for availability.

For example, on Ubuntu the php5-mysql package installs the ext/mysql, ext/mysqli, and pdo_mysql PHP extensions. On CentOS, the php-mysql package also installs these three PHP extensions.

Alternatively, you can compile this extension yourself. Building PHP from source allows you to specify the MySQL extensions you want to use, as well as your choice of client library for each extension.

The MySQL Native Driver is the recommended client library option, as it results in improved performance and gives access to features not available when using the MySQL Client Library. Refer to What is PHP’s MySQL Native Driver? for a brief overview of the advantages of MySQL Native Driver.

The /path/to/mysql_config represents the location of the mysql_config program that comes with MySQL Server.

mysqli compile time support matrix

PHP Version Default Configure Options: mysqlnd Configure Options: libmysqlclient Changelog
5.4.x and above mysqlnd —with-mysqli —with-mysqli=/path/to/mysql_config mysqlnd is the default
5.3.x libmysqlclient —with-mysqli=mysqlnd —with-mysqli=/path/to/mysql_config mysqlnd is supported
5.0.x, 5.1.x, 5.2.x libmysqlclient Not Available —with-mysqli=/path/to/mysql_config mysqlnd is not supported

Note that it is possible to freely mix MySQL extensions and client libraries. For example, it is possible to enable the MySQL extension to use the MySQL Client Library (libmysqlclient), while configuring the mysqli extension to use the MySQL Native Driver. However, all permutations of extension and client library are possible.

Installation on Windows Systems

On Windows, php_mysqli.dll DLL must be enabled in php.ini .

As with enabling any PHP extension (such as php_mysqli.dll ), the PHP directive extension_dir should be set to the directory where the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value is c:\php\ext .

Note:

If when starting the web server an error similar to the following occurs: «Unable to load dynamic library ‘./php_mysqli.dll'» , this is because php_mysqli.dll cannot be found by the system.

User Contributed Notes

Источник

Php extensions to be installed mysqli

This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide. Alternatives to this function include:

For compiling, simply use the —with-mysql[=DIR] configuration option where the optional [DIR] points to the MySQL installation directory.

Although this MySQL extension is compatible with MySQL 4.1.0 and greater, it doesn’t support the extra functionality that these versions provide. For that, use the MySQLi extension.

If you would like to install the mysql extension along with the mysqli extension you have to use the same client library to avoid any conflicts.

Installation on Linux Systems

Note: [DIR] is the path to the MySQL client library files (headers and libraries), which can be downloaded from » MySQL.

ext/mysql compile time support matrix

PHP Version Default Configure Options: mysqlnd Configure Options: libmysqlclient Changelog
4.x.x libmysqlclient Not Available —without-mysql to disable MySQL enabled by default, MySQL client libraries are bundled
5.0.x, 5.1.x, 5.2.x libmysqlclient Not Available —with-mysql=[DIR] MySQL is no longer enabled by default, and the MySQL client libraries are no longer bundled
5.3.x libmysqlclient —with-mysql=mysqlnd —with-mysql=[DIR] mysqlnd is now available
5.4.x mysqlnd —with-mysql —with-mysql=[DIR] mysqlnd is now the default

Installation on Windows Systems

PHP 5.0.x, 5.1.x, 5.2.x

MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of php.ini . Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems PATH . See the FAQ titled «How do I add my PHP directory to the PATH on Windows» for information on how to do this. Although copying libmysql.dll to the Windows system directory also works (because the system directory is by default in the system’s PATH ), it’s not recommended.

As with enabling any PHP extension (such as php_mysql.dll ), the PHP directive extension_dir should be set to the directory where the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value for PHP 5 is c:\php\ext

Note:

If when starting the web server an error similar to the following occurs: «Unable to load dynamic library ‘./php_mysql.dll'» , this is because php_mysql.dll and/or libmysql.dll cannot be found by the system.

PHP 5.3.0+

The MySQL Native Driver is enabled by default. Include php_mysql.dll , but libmysql.dll is no longer required or used.

MySQL Installation Notes

Crashes and startup problems of PHP may be encountered when loading this extension in conjunction with the recode extension. See the recode extension for more information.

Note:

If you need charsets other than latin (default), you have to install external (not bundled) libmysqlclient with compiled charset support.

Источник

MySQLi extension missing phpMyAdmin – Quick fix!

Usually, this error happens when MySQLi extension is not enabled in the php.ini file.

At Bobcares, we often receive requests to fix MySQLi extension missing errors as part of our Server Management Services.

Today, let’s analyze the error and see how our Support Engineers fix it for our customers.

What is MySQLi extension missing phpMyAdmin error?

Before getting deeper into the error, firstly, let’s understand what is MySQLi extension missing in phpMyAdmin?

The MySQLi functions allow us to access MySQL database servers and it’s a relational database driver used in the PHP scripting language. If the MySQLi extension is present we get this error.

A sample error at PHPMyAdmin will look like

How we fix the MySQLi extension missing phpMyAdmin?

So far, we have seen what is MySQLi extension missing in phpMyAdmin error. The solution for this error is to enable the MySQLi extension on the server.

Let’s see the different ways our Support Engineers fix this error for our customers by enabling MySQLi extension.

Enable MySQLi extension in php.ini file

First, we verify that the extension in PHP modules is enabled or not. For this, we run this command:

Let us discuss how our Support Engineers enable the MySQLi extension from the php.ini file in Linux and Windows.

In Linux

1. First, we open the php.ini file (/etc/php/php.ini )

2. Then we search for the commented line :

3. And, we uncomment the line by removing the hashtag from the beginning, such as:

At last, we restart the webserver.

In windows

1. We open the php.ini file

2 Then we search for the commented line:

3. And, we uncomment the line by removing the hashtag from the beginning, such as:

Thus enabling it resolved the error.

Enable MySQLi using EasyApache4

The simplest way to enable MySQLi is from EasyApache. Let us discuss how our Support Engineers enable it from EasyApache.

1. First, we login to the WHM as root.

2. Then we search for “EasyApache4” or go to Software > EasyApache4

3. At the top look for “Currently Installed Packages” and we click on the button “Customize”

4. Then on the left panel section, we click on “PHP Extensions”

5. After this, we search for mysqlnd.

6. We see something like “php70-php-mysqlnd” (depend on the PHP versions). We enable it.

7. Click on Review and and click on Provision button.

Enable MySQLi extension on web-server without any panel.

Our Support Engineers also provide a solution for the customers who are not using any panels. To enable MySQLi extension in the server without panel. We run the below command such as

# ./configure --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config

Then after, we check the MySQLi extension is enabled on the server.

Conclusion

In short, The error is mainly due to the missing of MySQLi extension in the php.ini file. Today we saw how our Support Engineers resolve the error MySQLi extension missing on PHPMyAdmin and the different ways to enable the MySQLi extension.

Источник

Оцените статью