1

I have a few domains hosted with Hostgator written using PHP 5.x. I recently received an email informing me update my code to PHP 7.x. The only major thing I had to do was to use mysqli instead of mysql. After testing my code on my local environment, I decided to FTP the code to a sub domain configured to use PHP 7.4. When I started testing the code on Hostgator, I saw in the error logs the following error:

Fatal error: Uncaught Error: Call to undefined function mysqli_connect()

If you click on the following link, you will see that the domain upgrade.inglesdaganzo.com is using PHP 7.4:

http://upgrade.inglesdaganzo.com/phpinfo.php

The thing is that I don't see that the mysqli extension is actually enabled, I don't see the usual information regarding the mysqli module/extension.

If you click on this link, you will see the error:

http://upgrade.inglesdaganzo.com/index.php

The php contained in index.php is this:

if (!function_exists('mysqli_connect')){
    echo "ERROR function 'mysqli_connect' was not found. It seems that the mysqli extension is not enabled ";
    //Do this so that Hostgator can see the error  
    mysqli_connect("localhost","a_user","a_password");
    
}else{
echo "GREAT 'mysqli_connect' was found";
}

I've been on to Hostgator a number of times and they say it's my problem and that it's all good at their end. They have configured PHP 7.4 correctly on their servers and that the problem is with my code. I really don't know what to do now.

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • _The only major thing I had to do was to use mysqli instead of mysql._ Not sure about that. take a look [here](https://stackoverflow.com/questions/1390607/how-to-change-mysql-to-mysqli/56997881) – Simone Rossaini Feb 18 '21 at 11:21
  • `Loaded Configuration File: /home2/gerry/public_html/upgrade/inglesdaganzo/php.ini` - that sounds like a file that was under _your_ control, and not like it was HostGator’s default PHP configuration file? So go check what that contains, regarding which extensions actually get loaded. – CBroe Feb 18 '21 at 11:22
  • Thanks for your answers. **Simone Rossaini** - The link you sent me what was I did more or less on my local machine, the problem is that on the Hostgator server, the same code throws Fatal error: Uncaught Error: Call to undefined function mysqli_connect() **CBroe** - This is what I have in the php.ini file: log_errors=On; Thanks for all your help guys, still trying to get this work :-( – Gerardo Macari Feb 18 '21 at 12:09

0 Answers0