Install MySQLnd extension for PHP 7.2.3 on PPC64LE with CentOS 7

I had installed PHP from source on PPC64LE with CentOS. I had enabled the MySQLi extension during configure options. For certain portions of my web app development, the MySQL connection functions weren’t working. I learned 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. So I wanted to install MySQL’s Native driver as it supports all MySQL extensions (i.e., MySQL, MySQLi, and PDO_MySQL).

If you don’t have MySQLnd extension installed, then you would probably see an error something similar as shown below:

 PHP Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::get_result()

Install MySQLnd extension

Step 1: To install the mysqlnd, navigate to ext/mysqlnd inside the PHP source folder.

[root@terra-node-01 mysqlnd]# cd /home/user/php-7.2.30/ext/mysqlnd

Step 2: Run phpize command

[root@terra-node-01 mysqlnd]# phpize
Configuring for:
PHP Api Version: 20170718
Zend Module Api No: 20170718
Zend Extension Api No: 320170718

Note: If you get the error “configure: error: cannot find sources (config.m4)” during step2, follow our solution here.

Step 3: Run Configure

[root@terra-node-01 mysqlnd]# ./configure

Note: If you get an error: configure: error: Cannot find OpenSSL’s <evp.h>, follow our solution guide here.

Step 4: Run make

[root@terra-node-01 mysqlnd]# make 2>&1 | tee err.log

Step 5: Run make install

[root@terra-node-01 mysqlnd]# make install

Final Step: No need to enable these extensions manually in php.ini. Just restart the apache service

[root@terra-node-01 mysqlnd]# systemctl restart httpd
Updated on May 14, 2020

Was this article helpful?

Related Articles

Leave a Comment