The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mysql_connect or mysqli_connect

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

  1. bridgeway04

    bridgeway04 Member

    Joined:
    Jun 2, 2008
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    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:
    145
    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
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,834
    Likes Received:
    672
    Trophy Points:
    113
    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.
     
Loading...
Similar Threads - mysql_connect mysqli_connect
  1. Muh'd Sany
    Replies:
    4
    Views:
    375

Share This Page