Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

mysql_connect or mysqli_connect

Discussion in 'Database Discussion' started by bridgeway04, Aug 21, 2014.

  1. bridgeway04

    bridgeway04 Member

    Joined:
    Jun 2, 2008
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    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
     
  2. triantech

    triantech Well-Known Member

    Joined:
    Jul 1, 2014
    Messages:
    143
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,277
    Likes Received:
    1,846
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice