Jump to content

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

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.