mysql_connect or mysqli_connect

bridgeway04

Member
Jun 2, 2008
8
0
51
We just migrated to a brand new cPanel server and one of my PHP pages that used to update our sales orders database stopped working. The database displays fine but it won't let me update any of the fields like it use to.

PHP Version: 5.4.30
MSQL Version: 5.5.37-cll

My first thought was since $db = mysql_connect has been deprecated, it might be time to update the PHP code. But when I tried a simple mysqli_connect to the same database I get "Fatal error: Call to undefined function mysqli_connect() in /home/ptmicom/public_html/admtools/connect.php on line 2".

<?php
$link = mysql_connect('localhost', 'orders', 'Xxxxxx123');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

Searched the web and it looks like I need to enable extension=php_mysql.dll but it is not in my php.inn file. How do I enable support for mysqli_connect?

Thanks,

Brad
 

triantech

Well-Known Member
Jul 1, 2014
143
1
18
Kochi, India, India
cPanel Access Level
Root Administrator
Hello,

You can run EasyApache and then select the required module, in your case mysqli_connect
from the Exhaustive Options List.

You can run EA from WHM as WHM: Main >> Software >> EasyApache (Apache Update)

or via ssh as

/scripts/easyapache
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello :)

You will find "MySQLi" under the "Exhaustive Options List" for PHP in EasyApache. Ensure you build Apache/PHP via EasyApache after selecting the module.

Thank you.