Conversion to msqli

Hello, I have a PHP5 code (hosted with Free) that I need to convert to PHP8 because it no longer works. I’m starting with the database connection code: Original: <link />
$link = mysql_connect ($host,$user,$pass) or die (); mysql_select_db($db);
They changed it to:
$link = mysqli_connect($host, $user, $pass, $db); // Vérification de la connexion if (!$link) { die("Échec de la connexion : " . mysqli_connect_error()); }
I’m getting the error: Fatal error: Call to undefined function: mysqli_connect() Why ?? And how to fix it? - Thanks

7 answers

  1. Hello,

    Is mysqli installed correctly?


    0
    1. I cannot provide a solution in French. Sorry.
      0
      1. Moderator

        Hello,

        Have you checked the active PHP version on your site?

        On one of mine I’m at PHP Version 5.6.40, not 8.5, so it depends on the servers. And also on the .htaccess where on Free you can select the version you chose.

        In the .htaccess I have an old parameter
        # Enable php5 on free.fr (php4 by default)
        php 5

        On a site without the .htaccess I’m at PHP Version 4.4.3-dev. And I tried to set php 8, I stay at 5.

        To display the version put a file like info.php containing <?php phpinfo(); ?> and run it manually.

        Migration might be in progress. Free has always been very poor at communication. I have 2 sites that are more accessible, neither via FTP nor with a browser.


        0
        1. The PHP version of my site on Free 4.4.3.

          But I suppose the problem comes from Free. I tested my site on another hosting provider, it works!!!

          0
          1. Moderator

            We return to the starting questions. Is the document physically uploaded on your site? If so, what is the SQL order error.


            0
            1. No. The document is not saved on the site, and no error is raised!

              And now nothing else displays except the HTML. Even the links no longer work!

              0