OzWaz Posted July 4, 2023 Share Posted July 4, 2023 I have developed a small website with a simple database using XAMPP. It worked fine. Now that I have uploaded it to a commercial hosting server, the PHP code that worked successfully within Xampp is being rejected ERROR [04-Jul-2023 02:55:12 UTC] PHP Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::get_result() in home/n3hyilyj4kst/public_html/mydomain.online/galery/fetchit.php:22 Is this normal or is this a developing feature with commercial servers Warren Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/ Share on other sites More sharing options...
OzWaz Posted July 4, 2023 Author Share Posted July 4, 2023 PS Line 22 "$result = $stmt->get_result();" Thanks Warren Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610237 Share on other sites More sharing options...
requinix Posted July 4, 2023 Share Posted July 4, 2023 get_result is only available if you're using mysqlnd, the exact details of that being mostly irrelevant as virtually everyone should be using it by now. What version of PHP are you using locally, and what version is on your server? Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610238 Share on other sites More sharing options...
OzWaz Posted July 5, 2023 Author Share Posted July 5, 2023 Thanks "requinix" for your help According to XAMPP it is version: 5.2.1 That would explain this circumstance. - A bit like me asking you what you had for "smoko"? But to deepen the mystery just a little, last year I developed a website for our local community as a noticeboard [ourplace.website] It functions perfectly and it recovers the data from the database using "$result = $stmt->get_result();" - It is hosted through GoDaddy (And still functioning) My granddaughter has just gone to work in London and I am developing a website where she can paste information for the family and images that we can all share but does not belong to Facebook. In developing this website I use the same code that functions on ‘ourplace’ - And it to is hosted by GoDaddy - also. I do know GoDaddy has been around for over 20 years and my understanding is that recently it changed hands and was purchased by one of the bigger conglomerates so maybe they were running an older version of PHP and the new guys have updated the system but I'm just including this information for the purposes of completeness. So it would now be a given that the commercial server would be running the latest, how do i resolve this issues as i an really not a php Guru I just 'borrow' code for the web that does a job Thanks - Warren Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610292 Share on other sites More sharing options...
OzWaz Posted July 5, 2023 Author Share Posted July 5, 2023 (edited) PS GoDaddy's phpmyadmin tell me they are running - 'Version information: PHP version: 7.4.33' - Warren Edited July 5, 2023 by OzWaz Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610293 Share on other sites More sharing options...
requinix Posted July 6, 2023 Share Posted July 6, 2023 It's rather unlikely that GoDaddy is running a PHP that isn't using mysqlnd. And I'm not sure that existed in the time of PHP 5.2. So this situation you're describing seems backwards. First things first, though: PHP 5.2 is extremely out of date. You need an version of XAMPP that has PHP 7.4 - to match what your real website is running. Frankly, I'm amazed XAMPP even provides PHP 5.2... Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610296 Share on other sites More sharing options...
gizmola Posted July 6, 2023 Share Posted July 6, 2023 3 hours ago, OzWaz said: I do know GoDaddy has been around for over 20 years and my understanding is that recently it changed hands and was purchased by one of the bigger conglomerates so maybe they were running an older version of PHP and the new guys have updated the system but I'm just including this information for the purposes of completeness. GoDaddy has a bunch of different hosting plans, and lots of servers. Experience with one particular server, doesn't predict exactly what you might experience with a different account, that is likely hosted on a different server. You can get a lot of information just using phpinfo() on each. As Requinix has already discussed, the issue points to lack of the mysqlnd driver. In GoDaddy's cpanel, you can change php configurations using the Select PHP Version. In the menu, I'm guessing you'll see mysqli checked, and nd_mysqli unchecked. There should also be a choice for mysqlnd, that may or may not be checked. If it is not checked, check it. Uncheck the mysqli option, and check the nd_mysqli option. Save this new configuration, and then retry your code. Please let us know if this fixes the issue. Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610299 Share on other sites More sharing options...
OzWaz Posted July 6, 2023 Author Share Posted July 6, 2023 Thanks Gizmola for your assistance I am already out of my depth in this subject. I have included a screenshot of the only place in GoDaddy's cPanel (DATABASES) I can find any mention of php and that is in the side panel of phpMyAdmin I have been unable to locate anything in their cPanel that is labelled "Select PHP version". Warren Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610315 Share on other sites More sharing options...
OzWaz Posted July 6, 2023 Author Share Posted July 6, 2023 UPDATE: To try and determine what part php on the server plays in my problem I grabbed a domain WHYMYPHP.ONLINE and uploaded the files, that I used for my website 12 months ago containing [Line 22 "$result = $stmt->get_result();"] into a directory in my hosting plan and they still worked perfectly. [Take a look if it helps] Now of course I don't know how GoDaddy runs their hosting business as to whether or not a single person's account and thereby their hosted websites all sit on the one server or whether like playing poker the cards get dealt, one card at a time to all the players sitting around the table. In which case my websites are spread consecutively around all the servers operated by the company. But I think it is interesting that I can still display the material from a database onto a website with go daddy that I have just established today but not the ones in my other website (omglondon.online) Does this help at all in your consideration of where the problem most likely lays Thanks Warren Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610318 Share on other sites More sharing options...
gizmola Posted July 6, 2023 Share Posted July 6, 2023 Phpmyadmin is just a PHP application. Access to the CPanel setting you want is described here: https://www.godaddy.com/help/view-or-change-the-php-version-for-my-linux-hosting-16090 Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610319 Share on other sites More sharing options...
mac_gyver Posted July 7, 2023 Share Posted July 7, 2023 the OP's screen prints show something interesting. libmysql is specifically listed, though it is not clear if this is just how the database client is being listed or if both of those are present. on the offending hosting, what does the mysqli section in the output from a phpinfo() statement in a .php script file show? how much overall database specific code do you have? converting to the much simpler and more modern PDO extension would eliminate this problem completely. Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610322 Share on other sites More sharing options...
gizmola Posted July 7, 2023 Share Posted July 7, 2023 2 hours ago, OzWaz said: UPDATE: To try and determine what part php on the server plays in my problem I grabbed a domain WHYMYPHP.ONLINE and uploaded the files, that I used for my website 12 months ago containing [Line 22 "$result = $stmt->get_result();"] into a directory in my hosting plan and they still worked perfectly. [Take a look if it helps] I looked at the site, opened the menu and tried to navigate to: http://whymyphp.online/galery/fetchit.php which produces a 500 error. This is the same issue we've been looking at, and we keep coming back to the fact that mysqli is not the version that has been linked to the myslqnd driver. This is not by any means a new issue. See this 4 year old SO question. The confusion relates to godaddy and cpanel, and the specific extensions that are enabled through cpanel. At this point, it is pretty much up to the OP to enable the right extensions through cpanel. Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610324 Share on other sites More sharing options...
OzWaz Posted July 7, 2023 Author Share Posted July 7, 2023 Okay I have located the correct area . Godaddy's webpage does not match their current lay out -but I found it thanks to your help Here are my choices-Below screen print As you will see these are the only options There is not facility to do this "you'll see mysqli checked, and nd_mysqli unchecked. There should also be a choice for mysqlnd, that may or may not be checked. If it is not checked, check it. Uncheck the mysqli option, and check the nd_mysqli option." Thanks Warren Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610332 Share on other sites More sharing options...
OzWaz Posted July 7, 2023 Author Share Posted July 7, 2023 Don't know if this is useful but here is the server specs- screen print below I also had done this http://whymyphp.online/info.php In case this may help Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610333 Share on other sites More sharing options...
dodgeitorelse3 Posted July 7, 2023 Share Posted July 7, 2023 (edited) Have you tried putting this code into a php file and running it to see what you have? <?php // Show all information, defaults to INFO_ALL phpinfo(); ?> in your web browser use edit/find in page and search for mysqlnd. That would be for firefox browser. Chrome browser would be search/find Edited July 7, 2023 by dodgeitorelse3 added more content Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610335 Share on other sites More sharing options...
OzWaz Posted July 10, 2023 Author Share Posted July 10, 2023 Thanks Dodgeitorelse3 but i have already did this See above @7:27 - Not that it means a great deal to me Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610416 Share on other sites More sharing options...
dodgeitorelse3 Posted July 10, 2023 Share Posted July 10, 2023 I see where you got info from phpmyadmin and from godaddy cpanel but not from phpinfo. phpinfo will tell you a lot more of what ytou have running. Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610419 Share on other sites More sharing options...
dodgeitorelse3 Posted July 10, 2023 Share Posted July 10, 2023 (edited) I stand corrected. I see the link for phpinfo now. That shows that you have mysqlnd enabled and it is version 7.4.33 and your mysqli version is 5.7.42 Edited July 10, 2023 by dodgeitorelse3 Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610420 Share on other sites More sharing options...
mac_gyver Posted July 10, 2023 Share Posted July 10, 2023 (edited) just because the mysqlnd driver is loaded, doesn't mean that mysqli (or PDO_mysql) will use it, if mysqli wasn't built to use the mysqlnd driver. the mysqli section, Client API library version, would read - mysqlnd 7.4.33, and the last line in the mysqlnd section, API extensions, would list mysqli. to get this to work, your php installation, regardless of php version (5.3+), must be built to include the mysqlnd driver (which it apparently has been) and the mysqli extension must be built to use the mysqlnd driver (which it has not been.) i'll ask/suggest this again - On 7/6/2023 at 6:47 PM, mac_gyver said: how much overall database specific code do you have? converting to the much simpler and more modern PDO extension would eliminate this problem completely. Edited July 10, 2023 by mac_gyver Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610421 Share on other sites More sharing options...
gizmola Posted July 16, 2023 Share Posted July 16, 2023 On the most recent screenshot you provided, what do you see when you click on the "manage" link next to line that shows php version 7.4? Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610503 Share on other sites More sharing options...
OzWaz Posted July 18, 2023 Author Share Posted July 18, 2023 As Requested I think it is time to admit defeat and abandon the project. This is way beyond my knowledge set Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610568 Share on other sites More sharing options...
mac_gyver Posted July 18, 2023 Share Posted July 18, 2023 (edited) why are you using an obsolete and no longer supported php version? as long as your code isn't using any previously deprecated features that have been removed in php8+, most straight-forward code should work as is under php8+. it is more likely that the currently supported versions of php have had the mysqli extension built to use the mysqlnd driver. temporarily switch to one of the php8+ versions and check the phpinfo() output to see if/which database extensions are listed in the mysqlnd section, API extensions. if you post your code, someone could advise how to convert it to use the PDO extension, or could possible do it for you out of shear frustration at how simple the PDO extension is to learn and use over the mysqli extension. Edited July 18, 2023 by mac_gyver Quote Link to comment https://forums.phpfreaks.com/topic/317044-transitioning-from-xampp/#findComment-1610572 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.