Page 1 of 1

error: mysqli_connect() not defined

Posted: Wed Oct 29, 2008 11:04 pm
by shrg18
I have been having this problem on the web server for more than a week. Could not find a solution.

The testing script is simple:

Code: Select all

$dbc = mysqli_connect($dbhost, $dbusername, $dbpassword, $dbdatabase) or die ("ERROR: Cannot connect");
It returns an error message:
Fatal error: Call to undefined function: mysqli_connect() in /home/hppin3/public_html/demo/test/test_mysqli_availability.php on line 53
The same testing script works fine on the localhost, xampp.

mysqli extension in php.ini is commented out.

I have a shared host domain and 4-5 subdomains. All have the same problem. After changing from mysqli to mysql, the scripts run well.

I sent emails to the service department, they never respond. Usually they don't respond to those script problems. But I cannot tell whether it is a website problem or a script problem. Since the mysqli script works fine on the localhost, it should be a website problem. Why they don't respond?

Any advice will be very helpful.

Thanks

Re: error: mysqli_connect() not defined

Posted: Thu Oct 30, 2008 10:21 am
by pickle
I hope you're not honestly wanting a response to why your host doesn't respond - why should we know?

It looks like you discovered the problem - the extension is commented out in php.ini. It needs to be enabled in order to use it's functions.

Re: error: mysqli_connect() not defined

Posted: Thu Oct 30, 2008 10:37 pm
by shrg18
pickle wrote:I hope you're not honestly wanting a response to why your host doesn't respond - why should we know?

It looks like you discovered the problem - the extension is commented out in php.ini. It needs to be enabled in order to use it's functions.
My understanding of enabling mysqli is to comment its extension out in php.ini, is it correct?

They are indeed all commented out in those domains, like this:

Code: Select all

 
extension=php_mysql.dll
extension=php_mysqli.dll
Anything else required to enable mysqli except this commenting issue?

Re: error: mysqli_connect() not defined

Posted: Fri Oct 31, 2008 10:40 am
by pickle
It doesn't look like it - that should be it.

"Commenting out" means to make something a comment. So if you are "commenting out" the extension in php.ini, you are in effect disabling it.

It seems you're not using the term "commenting out" in the way I (and the rest of the community) use it. Just a heads-up.

Re: error: mysqli_connect() not defined

Posted: Fri Oct 31, 2008 9:47 pm
by shrg18
pickle wrote:It doesn't look like it - that should be it.

"Commenting out" means to make something a comment. So if you are "commenting out" the extension in php.ini, you are in effect disabling it.

It seems you're not using the term "commenting out" in the way I (and the rest of the community) use it. Just a heads-up.
Should I use "uncomment"? The fact is to remove ";" from the first place of the line.

After "uncomment", what should I do to enable it? or is it enabled by this ";" removing?

It is the only solution I could read online, but it doesn't solve the problem.

Re: error: mysqli_connect() not defined

Posted: Sun Nov 02, 2008 9:20 pm
by shrg18
Update

There is a setting of php5 on the host, if run php5 scripts, it has to be enabled manually. For some reasons unknown, php5 had been disabled but shown "enabled". The writer of the host forum advised to looking at the php5 setting.

After "disable" and "enable" it again, php5 is working fine. Now the sites are back to normal.

the status of mysqli extension in php.ini stays untouched.

the problem is solved. Pickle, thanks for your attention and concern.