cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New

MySQL PHP Connection

Hi All,

 

Trying again...I am trying to connect to MySQL database located on a droplet (Digital Ocean) via my web host godaddy. I can connect to the database through localhost using XAMPP (v5.3) but when I upload my PHP and XAMPP's php.in file to my godaddy root directory I get the error message:

 

Fatal error: Call to undefined function mysqli_connect() in ....public_html/test1.php on line 4

 

 

This is really doing my head in. Could anyone please help?

 

Alex

 

4 REPLIES 4
Anonymous
Not applicable

Re: MySQL PHP Connection

Hi @ald878,

have you looked for the error? A quick clue, when you get an error line 4 for example, the actual error is often in the line above. Check the error!

New

Re: MySQL PHP Connection

Hi rammsteinium,

 

Thank you for the reply. Like I said the code works fine when running on my local machine via localhost through XAMPP just not when I load the php file into my godaddy root directory.

 

For some reason I cant copy and paste my code into this chat as it wont let me post for some reason. But it is very simple code using $conn = mysqli_connect('188.16...', 'alexTest', 'alexTest', 'dbTest');

 

Any more suggestions??

 

Thanks,

 

Alex.

New

Re: MySQL PHP Connection

After a bit of research I have seen that msqli and mysql functions are not installed on godaddy which is confirmed when i run the below php script print_r(get_loaded_extensions()); 

 

Can anyone please confirm if this is a limitation of godaddy meaning I will have to change web hosts???

 

Alex.

Re: MySQL PHP Connection

I too am having the same problem.  I ran your script on my host and it does show mysql and mysqli.  I cant figure it out....

 

Array ( [0] => Core [1] => date [2] => ereg [3] => libxml [4] => openssl [5] => pcre [6] => sqlite3 [7] => zlib [8] => bz2 [9] => calendar [10] => ctype [11] => curl [12] => hash [13] => filter [14] => ftp [15] => gettext [16] => gmp [17] => SPL [18] => iconv [19] => pcntl [20] => readline [21] => Reflection [22] => session [23] => standard [24] => shmop [25] => SimpleXML [26] => mbstring [27] => tokenizer [28] => xml [29] => cgi-fcgi [30] => bcmath [31] => dom [32] => fileinfo [33] => gd [34] => imagick [35] => imap [36] => inotify [37] => intl [38] => json [39] => exif [40] => mcrypt [41] => mysql [42] => mysqli [43] => PDO [44] => pdo_mysql [45] => pdo_sqlite [46] => Phar [47] => posix [48] => soap [49] => xmlreader [50] => xmlrpc [51] => xmlwriter [52] => mhash )