Link to home
Start Free TrialLog in
Avatar of Crazy Horse
Crazy HorseFlag for South Africa

asked on

Call to undefined method mysqli_stmt on one live server but not the other

I uploaded a site to a live server to test it and I get this error in the log :

PHP Fatal error:  Uncaught Error: Call to undefined method mysqli_stmt::get_result()

I uploaded exactly the same pages to another host and the site works. Why would this be? A quick google made mention of a mysqlnd driver being required but not sure if this is a fact.

Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Crazy Horse

ASKER

mysqli has a bunch of info like library version, socket etc.

mysqlnd just shows some authors  - Andrey Hristov, Ulf Wendel, Georg Richter, Johannes Schlüter. And that's it!
Yeah, it sounds like it's missing.  Ask the hosting company to install it.
I am asking them now. Not sure they are going to help :(

Can you think why they would not install this in the first place?

I mean, this is a pretty well known hosting company. Supposedly one of the best.
Avatar of Julian Hansen
Which hosting company is it?

Often they provide access to different versions of PHP - if you go into the control panel (usually CPanel) you can change the version of PHP there - it might be they have your package defaulted to an older version of PHP that does not support mysqli.
Bluehost. I actually changed from php 5. something to php 7. So, I am using php 7 and I did verify that using
<?php phpinfo();

Open in new window

as Ray suggested.
Hosting companies often compile their own versions of PHP so they can control how it is used.  Only two of five hosts that I just checked include 'mysqlnd'.  One is on PHP 5.3 and another on PHP 5.5 so it is not dependent on the Version.
Bluehost is pretty good, but PHP 7 is still pretty new, at least for shared hosting companies.  It might be a simple oversight.
They seem to be having trouble sorting it out for me. I'm pretty screwed if it doesn't work because my code uses a significant amount of php 7 and I use prepared statements and I think get_result() is one of the things that requires the missing piece of the puzzle on the hosting side of things. So, I would have to go and change every single one of my prepared statements in some way. That kinda makes me want to cry.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yeah, that would have been my first choice but I'm signed up with them until the middle of 2018 and I paid up front. When I initially signed up on the package months ago I didn't realize I was going to have difficulties. I thought that it would work just like my localhost does. I guess that is not the case!
Is it something that can be edited on the php.ini file? I have access to that file so if I can just change something in there that would be great. But not sure if it's as simple as that.
Ouch! Then I would go to them and demand a fix or a refund - not sure that will get you anywhere. Personally I never pay for hosting for more than 3 months in advance - usually monthly - simply because I want the flexibility of moving if the ISP does not dance to the tune I am playing.
Yes, lesson learned now. The hard way! They said they cannot do it for me with php 7, only php 5. That does not help me. They said they are working on it and plan to have it working soon but can't give me an eta.

I suppose I will have to pay for hosting elsewhere until such time as Bluehost have it working.

How disappointing!
In case anybody has bad luck like me and wants to know, I just contacted Siteground as well, they too do not offer this on their shared hosting package.

Does anyone know of a host that actually supports mysqlnd with php7? I found a host in the UK that does but with the exchange rate it's too expensive.
Correction. Siteground do not support it at all. Is mysqlnd  bad? Or why would people choose not to enable it?
I don't know if this helps but 'mysqlnd' comes standard with the Windows versions of PHP 7 (and 5.3 and up).  I don't know why Linux hosting isn't supporting it.
That's cool! But isn't Windows hosting considerably more expensive?
Windows hosting suffers from the handicap that all the pro hosting companies prefer Linux.  (Dave and I may disagree on this).

There's a "thanks to" page at PHP.net that lists some of the best PHP hosting companies.
http://php.net/thanks.php

You might also look to Bitnami and see if they have a LAMP stack with MySQLND.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Anyone have an opinion on these guys?

https://www.ultrawebhosting.com/shared-web-hosting-features

According to their live chat assistance, they offer php 7 and MySQLND.

I have realized after searching, that there are LOADS of companies to choose from. And it's giving me a headache! Rather too many than too few I suppose.