Jump to content

[SOLVED] MySQL Version


rarebit

Recommended Posts

Without connecting to MySQL how do you find out if it's available and which version?

 

I'm seeing all of the following directives in php.ini:

mysql.allow_local_infile, mysql.allow_persistent, mysql.cache_size, mysql.connect_timeout, mysql.default_host, mysql.default_password, mysql.default_port, mysql.default_socket, mysql.default_user, mysql.max_links, mysql.max_persistent, mysql.trace_mode

 

But what is best way to check for version?

Link to comment
https://forums.phpfreaks.com/topic/132465-solved-mysql-version/
Share on other sites

phpinfo returns the mysql client version. Not the actual version of the MySQL server. To get the version of MySQL installed first connect to MySQL then use the mysql_get_server_info function.

 

This does give what I want, but at the stage of use I wouldn't have any DB details.

 

This is now the best i've found, but still no version (unless I search the system myself?):

if (extension_loaded('mysql'))
{
print "MySQL available<br>";
}

Link to comment
https://forums.phpfreaks.com/topic/132465-solved-mysql-version/#findComment-688741
Share on other sites

Ok, i'm struggling with preg_split (and PREG_SPLIT_DELIM_CAPTURE), but surely theres got to be an easier way than this?

ob_start();
$x = eval("phpinfo();");
$l = ob_get_contents();
ob_end_clean();

$chars = preg_split('/Client API version <\/td><td class="v">(*) <\/td>/', $l, -1, PREG_SPLIT_DELIM_CAPTURE);

 

Is there a way to get 'phpinfo' back as an array?

Link to comment
https://forums.phpfreaks.com/topic/132465-solved-mysql-version/#findComment-688795
Share on other sites

You were already told, a few hours ago, that the php client API version has no direct relation to the mysql server version -

phpinfo returns the mysql client version. Not the actual version of the MySQL server. To get the version of MySQL installed first connect to MySQL then use the mysql_get_server_info function.

Link to comment
https://forums.phpfreaks.com/topic/132465-solved-mysql-version/#findComment-688814
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.