rarebit Posted November 12, 2008 Share Posted November 12, 2008 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 More sharing options...
n3ightjay Posted November 12, 2008 Share Posted November 12, 2008 <?php phpinfo(); ?> Link to comment https://forums.phpfreaks.com/topic/132465-solved-mysql-version/#findComment-688706 Share on other sites More sharing options...
php-pendejo Posted November 12, 2008 Share Posted November 12, 2008 not really sure but try phpinfo(); Link to comment https://forums.phpfreaks.com/topic/132465-solved-mysql-version/#findComment-688708 Share on other sites More sharing options...
wildteen88 Posted November 12, 2008 Share Posted November 12, 2008 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-688710 Share on other sites More sharing options...
rarebit Posted November 12, 2008 Author Share Posted November 12, 2008 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 More sharing options...
rarebit Posted November 12, 2008 Author Share Posted November 12, 2008 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 More sharing options...
premiso Posted November 12, 2008 Share Posted November 12, 2008 Doesnt look like it. phpinfo However you can extract certain parts, so you only pull the section you want. Might make it a little cleaner and less code to go through. Link to comment https://forums.phpfreaks.com/topic/132465-solved-mysql-version/#findComment-688808 Share on other sites More sharing options...
PFMaBiSmAd Posted November 12, 2008 Share Posted November 12, 2008 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 More sharing options...
rarebit Posted November 12, 2008 Author Share Posted November 12, 2008 So at install time, the best I can do (without a system search) is: if (extension_loaded('mysql')) { print "MySQL available<br>"; } Link to comment https://forums.phpfreaks.com/topic/132465-solved-mysql-version/#findComment-688822 Share on other sites More sharing options...
Mchl Posted November 12, 2008 Share Posted November 12, 2008 Not really. An extension might be loaded, but server might not be available. You can't actually tell without trying to connect... Link to comment https://forums.phpfreaks.com/topic/132465-solved-mysql-version/#findComment-688830 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.