wrathican Posted October 24, 2008 Share Posted October 24, 2008 Hey people im trying to make an installer script but want to make some server checks before the script works it's magic. how can i check the version of mysql installed on the server. i need to be able to check without running shell commands and without actually having to connect Thanks Wrath Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted October 24, 2008 Share Posted October 24, 2008 you could create an info.php script like this <?php phpinfo(); ?> And then just run it in your browser Quote Link to comment Share on other sites More sharing options...
wrathican Posted October 24, 2008 Author Share Posted October 24, 2008 sorry i should have said, the script needs to be able to check the version. not the user. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted October 24, 2008 Share Posted October 24, 2008 try this http://us3.php.net/manual/en/function.mysql-get-server-info.php Quote Link to comment Share on other sites More sharing options...
discomatt Posted October 24, 2008 Share Posted October 24, 2008 http://www.codingforums.com/showthread.php?t=95264 exec() and phpinfo() seem to be your best bets. If you choose to go phpinfo(), rather than using this $file = @file_get_contents("http://YOURDOMAINHERE/phpinfo.php"); You're better off with ob-start(); phpinfo(); $file = ob_get_clean(); Quote Link to comment Share on other sites More sharing options...
discomatt Posted October 24, 2008 Share Posted October 24, 2008 try this http://us3.php.net/manual/en/function.mysql-get-server-info.php Requires connection. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 24, 2008 Share Posted October 24, 2008 phpinfo() only shows the client library version. Quote Link to comment Share on other sites More sharing options...
wrathican Posted October 24, 2008 Author Share Posted October 24, 2008 Thanks for the replies. dennis: what discomatt said discomatt: what PFMaBiSmAd said and i was thinking to do what you said, but then i found that out. any other suggestions? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 24, 2008 Share Posted October 24, 2008 Since php does not have this information available (mysql is a separate service from the web server/php), the only way that will consistently work will involve you asking mysql what version it is, either through a query or a command line statement. Quote Link to comment Share on other sites More sharing options...
discomatt Posted October 24, 2008 Share Posted October 24, 2008 No, I don't think there's a consistent way without connecting or using a command-line call. What's wrong with connecting first? Quote Link to comment Share on other sites More sharing options...
wrathican Posted October 24, 2008 Author Share Posted October 24, 2008 oh nothing, i just wanted the to see if it was possible to make sure everything was ok before anything is installed. Thanks for the help anyway chaps. I guess i'm going to have to connect first Quote Link to comment 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.