khunjack Posted December 14, 2016 Share Posted December 14, 2016 Hi, Using a new external script and I'm getting the following error: Fatal error: Call to undefined function mysqli_stmt_get_result() in /home/.... According to the script developer, an host issue. I asked my server management company and they came back with this answer: The PHP version of your server is 5.4.45. You are receiving the error because mysqli_stmt_get_result() is only available on PHP 5.3 installations that are compiled with the mysqlnd extension, which is the MySQL Native Driver available with PHP 5.3. PHP 5.3 is end-of-life versions of PHP and which is not even available in Easyapache 4 which has multi-PHP but CloudLinux does offer that support. You would need to install cloudlinux or need to downgrade the server's PHP version to 5.3 which is not recommended. Please let us know if you need any further assistance. Note: o currently I need to stick with mod_php and php 5.4.45 o According to phpinfo: mysql, mysqli, mysqlnd is installed. If it is correct that "mysqli_stmt_get_result" is only avaialble till php 5.3? Any suggestion how to tackle this issue? Thanks a lot in advance Jack Quote Link to comment https://forums.phpfreaks.com/topic/302734-mysqli_stmt_get_result-problem-config-issue/ Share on other sites More sharing options...
Jacques1 Posted December 14, 2016 Share Posted December 14, 2016 (edited) If it is correct that "mysqli_stmt_get_result" is only avaialble till php 5.3? Nonsense. The mysqlnd driver is the default since PHP 5.4. If it's not available, that's because your hoster has explicily disabled it during installation. If you can't get a PHP version with mysqlnd, you or your developer should be able to easily replace mysqli_stmt_get_result(). If the PDO extension is available, that's an even better alternative to mysqli. Edited December 14, 2016 by Jacques1 Quote Link to comment https://forums.phpfreaks.com/topic/302734-mysqli_stmt_get_result-problem-config-issue/#findComment-1540305 Share on other sites More sharing options...
khunjack Posted December 14, 2016 Author Share Posted December 14, 2016 Jacques1, Thank you very much for your fast reply. I understand the external server management company I use, (not my host/server company) explanation is misleading. Do you see a way for me to see, if it is disabled and to enable the native driver ? Thanks a lot. Jack PS: I wasn't sure if for new dev. I would use mysqli or PDO. I will go for PDO. PS: I'm a little bit reluctant to tell them. They just tried to upgrade to Easyapache 4 which didn't work with mod_php and all sites on this server where not accessible for nearly 24 hrs. Quote Link to comment https://forums.phpfreaks.com/topic/302734-mysqli_stmt_get_result-problem-config-issue/#findComment-1540306 Share on other sites More sharing options...
mac_gyver Posted December 14, 2016 Share Posted December 14, 2016 According to phpinfo: mysql, mysqli, mysqlnd is installed. just because mysqlnd is installed, doesn't mean that the mysqli or PDO extension will use it. your installation of php would need to be compiled with switches set causing the mysqli and/or PDO extensions to use the mysqlnd driver. there would be mysqlnd entries shown in the client api sections of the msyqli/pdo_mysql phpinfo output. if the script cannot be easily switched to use the PDO extension, you may (untested) be able to conditionally detect the existence of the get_result() method and extend the mysqli stmt class with a user written method that returns an instance of a user written class that emulates the features of a mysqli result class that the script is using (afaik, it is not possible to create and return an actual populated instance of the built-in mysqli result class). this of course is just a kluge. the whole php mysqli prepared query implementation is bad, and this is just one more case highlighting that it should not be used. Quote Link to comment https://forums.phpfreaks.com/topic/302734-mysqli_stmt_get_result-problem-config-issue/#findComment-1540313 Share on other sites More sharing options...
khunjack Posted December 14, 2016 Author Share Posted December 14, 2016 (edited) mac_gyver,Jacques1 Thanks to you both for your replies and help. Very appreciated (What a great board). Made me find a routine. I just checked and got - MySQL is installed.- MySQLi is installed.- libmysqlclient driver is being used.- PDO MySQLnd is enabled. Seems I will be ok using PDO I used : <?php if (function_exists('mysql_connect')) { echo "- MySQL <b>is installed</b>.<br>"; } else { echo "- MySQL <b>is not</b> installed.<br>"; } if (function_exists('mysqli_connect')) { echo "- MySQLi <b>is installed</b>.<br>"; } else { echo "- MySQLi <b>is not installed</b>.<br>"; } if (function_exists('mysqli_get_client_stats')) { echo "- MySQLnd driver is being used.<br>"; } else { echo "- libmysqlclient driver is being used.<br>"; } $pdo = new PDO('mysql:host='.$dbHost.';dbname='.$dbName, $dbUser, $dbPass); if (strpos($pdo->getAttribute(PDO::ATTR_CLIENT_VERSION), 'mysqlnd') !== false) { echo '- PDO MySQLnd <b>is enabled</b>.<br>'; } else { echo '- PDO MySQLnd <b>is not enabled</b>.<br>'; } ?> Edited December 14, 2016 by khunjack Quote Link to comment https://forums.phpfreaks.com/topic/302734-mysqli_stmt_get_result-problem-config-issue/#findComment-1540323 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.