error: mysqli_connect() not defined

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
shrg18
Forum Newbie
Posts: 5
Joined: Wed Mar 12, 2008 8:21 pm

error: mysqli_connect() not defined

Post 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
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: error: mysqli_connect() not defined

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
shrg18
Forum Newbie
Posts: 5
Joined: Wed Mar 12, 2008 8:21 pm

Re: error: mysqli_connect() not defined

Post 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?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: error: mysqli_connect() not defined

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
shrg18
Forum Newbie
Posts: 5
Joined: Wed Mar 12, 2008 8:21 pm

Re: error: mysqli_connect() not defined

Post 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.
shrg18
Forum Newbie
Posts: 5
Joined: Wed Mar 12, 2008 8:21 pm

Re: error: mysqli_connect() not defined

Post 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.
Post Reply