Jump to content

mysqli_stmt_get_result, problem, config issue ?


Recommended Posts

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

 

 

 

 

 

 

 

Link to comment
Share on other sites

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 by Jacques1
Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by khunjack
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.