MySQL PHP Connection via godaddy

Codes here !

Moderators: egami, macek, gesf

Post Reply
ald878
New php-forum User
New php-forum User
Posts: 5
Joined: Sat Feb 11, 2017 9:11 pm

Sat Feb 11, 2017 9:21 pm

Hi all,

I am trying to connect to a MySQL database located on a droplet (digital ocean) via my web host godaddy. Script below:

Code: Select all

<?php
$conn = mysqli_connect('188.16.....', 'username', 'password','dbName');

if (!$conn) {
    die("Connection failed");
}
echo "Connected!";
?>
I can connect to this database through localhost with no problems via XAMPP (v5.6.3) but when I run it through godaddy (uses PHP v5.6.28) I receive the below error message.

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

I have spent the last 2 days reading forums for help but none of the solutions seem to work for me.I have tried putting the XAMPP php.ini file (and php5.ini) to my godaddy cPanel root directory (public_html). I have also made sure the php_mysqli.dll is uncommented out in the php.ini file but still no luck.

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

Thanks,

Alex.

NigelRen
php-forum Fan User
php-forum Fan User
Posts: 622
Joined: Fri Aug 05, 2011 9:53 am

Sun Feb 12, 2017 1:07 am

Try seeing what php info gives you...

Code: Select all

<?php
phpinfo();
Should show you which options are available and what is configured.

ald878
New php-forum User
New php-forum User
Posts: 5
Joined: Sat Feb 11, 2017 9:11 pm

Sun Feb 12, 2017 2:22 am

Thanks for the reply. The result I get is below but i'm not sure what i am looking for?

Code: Select all

Configure Command:
'./configure' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/opt/alt/php56' '--exec-prefix=/opt/alt/php56' '--bindir=/opt/alt/php56/usr/bin' '--sbindir=/opt/alt/php56/usr/sbin' '--sysconfdir=/opt/alt/php56/etc' '--datadir=/opt/alt/php56/usr/share' '--includedir=/opt/alt/php56/usr/include' '--libdir=/opt/alt/php56/usr/lib64' '--libexecdir=/opt/alt/php56/usr/libexec' '--localstatedir=/var' '--with-curl=/opt/alt/curlssl/usr' '--sharedstatedir=/usr/com' '--mandir=/opt/alt/php56/usr/share/man' '--infodir=/opt/alt/php56/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/opt/alt/php56/etc' '--with-config-file-scan-dir=/opt/alt/php56/link/conf' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-vpx-dir=/usr' '--enable-gd-native-ttf' '--with-t1lib=/opt/alt/t1lib/usr' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/opt/alt/pcre/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-sockets=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-sysvmsg=shared' '--with-kerberos' '--enable-shmop' '--enable-calendar' '--with-libxml-dir=/opt/alt/libxml2/usr' '--enable-xml' '--with-mcrypt=shared,/usr' '--with-tidy=shared,/usr' '--with-readline' '--with-mhash' '--enable-dbx=shared' '--with-zlib-dir=/usr' '--disable-opcache' '--with-mssql=shared,/opt/alt/freetds/usr' '--with-pdo-dblib=shared,/opt/alt/freetds/usr' '--with-interbase=shared,/usr' '--with-pdo-firebird=shared,/usr' '--enable-phpdbg' '--enable-force-cgi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--enable-mbregex' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--enable-dom=shared' '--with-pgsql=shared' '--enable-wddx=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--with-icu-dir=/opt/alt/libicu/usr' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/opt/alt/sqlite/usr' '--enable-json=shared' '--enable-zip=shared' '--with-pspell=shared' '--enable-phar=shared' '--enable-posix=shared' '--with-unixODBC=shared,/usr' '--enable-fileinfo=shared' '--enable-intl=shared' '--enable-sqlite3=shared,/opt/alt/sqlite/usr' '--with-enchant=shared,/usr' '--with-sybase-ct=shared,/opt/alt/freetds/usr' '--with-recode=shared,/usr' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 '-g' '-pipe' '-Wall' '-Wp,-D_FORTIFY_SOURCE=2' '-fexceptions' '-fstack-protector' '--param=ssp-buffer-size=4' '-m64' '-mtune=generic' '-fno-strict-aliasing' '-Wno-pointer-sign'' 'LDFLAGS= '-Wl,-rpath=/opt/alt/curlssl/usr/lib64,-rpath=/opt/alt/libssh2/usr/lib64,-rpath=/opt/alt/libxml2/usr/lib64,-rpath=/opt/alt/pcre/usr/lib64,-rpath=/opt/alt/t1lib/usr/lib64,-rpath=/opt/alt/freetds/usr/lib64,-rpath=/opt/alt/sqlite/usr/lib64,-rpath=/opt/alt/libicu/usr/lib64'


Server API:  CGI/FastCGI
Virtual Directory Support:  disabled
Configuration File (php.ini) Path /opt/alt/php56/etc
Loaded Configuration File:	/home/ald0/public_html/php.ini
Scan this dir for additional .ini files:	/opt/alt/php56/link/conf


Thanks,

Alex.

ald878
New php-forum User
New php-forum User
Posts: 5
Joined: Sat Feb 11, 2017 9:11 pm

Mon Feb 20, 2017 11:03 pm

Hi All,

Just wondering if any one could please please help??

Alex.

NigelRen
php-forum Fan User
php-forum Fan User
Posts: 622
Joined: Fri Aug 05, 2011 9:53 am

Mon Feb 20, 2017 11:34 pm

To be honest - I have no experience of using GoDaddy so can't even try anything out. But have you looked into posts like https://forums.cpanel.net/threads/how-t ... li.142737/ which may give you some indications?

ald878
New php-forum User
New php-forum User
Posts: 5
Joined: Sat Feb 11, 2017 9:11 pm

Tue Feb 21, 2017 3:00 am

Thanks NigelRen I will take a look. I have figured mysql and mysqli functions are not loaded on godaddy which is a pain and I am not sure if there is a work around. If not I am happy to change web hosts.

Alex.

php4blog
New php-forum User
New php-forum User
Posts: 6
Joined: Thu Feb 16, 2017 12:57 am

Tue Feb 21, 2017 4:35 am

You can put just simple function you can connect your database before connect other database of server you need to put all the function perfectly and in your digital ocean you need to install LAMP Perfectly. or see How to connect database in PHP refer this It will help you Before start anything in server you must install one sql server in Digital Ocean It will surely help you.
Thanks

ald878
New php-forum User
New php-forum User
Posts: 5
Joined: Sat Feb 11, 2017 9:11 pm

Tue Feb 21, 2017 5:32 pm

Thanks for the reply. Like I said previosuly I have setup and can connect to the MySQL database on the droplet using XAMPP. Just not through my web host godaddy (uses CPanel). I have seen mysql and mysqli functions are not loaded on godaddy which is obviosuly the problem.

What I would like to know is if there is another web host which has these functions enabled so i can do the simple task of connecting to the database located on a server? Or can i load these functions into CPanel.

Alex.

NigelRen
php-forum Fan User
php-forum Fan User
Posts: 622
Joined: Fri Aug 05, 2011 9:53 am

Tue Feb 21, 2017 11:57 pm


Post Reply