N1CK3RS0N Posted April 13, 2009 Share Posted April 13, 2009 Hello, Posted in wrong forum and it got moved into MySQL forums, but its more of a PHP question. I'm working on an installer for a CMS and for the pre-install check it needs to check various things. Folder and file write permissions, php version, xml extensions, and MySQL version. Unfortuneatly there's no function or easy way for finding the MySQL version. The only way that I could think of would be to use a type of explode on phpinfo(). I'm still new to PHP so not sure on how I should go about doing this. Quote Link to comment https://forums.phpfreaks.com/topic/153934-solved-find-mysql-version-without-connection-to-database/ Share on other sites More sharing options...
Mchl Posted April 13, 2009 Share Posted April 13, 2009 I'll say again what I said in previous thread. There is no MySQL server information in phpinfo(). Quote Link to comment https://forums.phpfreaks.com/topic/153934-solved-find-mysql-version-without-connection-to-database/#findComment-809013 Share on other sites More sharing options...
ToonMariner Posted April 13, 2009 Share Posted April 13, 2009 abstract your database layer - use the pear DB library... alternatively with your installer - get the user to give database connection details - check the version and have the installer download the appropriate file(s) from yoru own server to allow your application to function. I am a fan of remote installs (that's what I call them any way) it allows you to provide auto updates and ensures that the applications you build have the appropriate technology support. you could even have a checker that when run will check the apps settings and if the dependant database version, platform or php installation has been upgraded it could auto update your entire app... people pay for that kind of quality automated support. Quote Link to comment https://forums.phpfreaks.com/topic/153934-solved-find-mysql-version-without-connection-to-database/#findComment-809019 Share on other sites More sharing options...
laffin Posted April 13, 2009 Share Posted April 13, 2009 Q: how do u propose to get information from the mysql server without making a connection? MySQL servers don't need to be hosted on the same computer (and in larger environments, they get to be the only service on a server). only way is to ask the command line util to display wut version it is, but this is limited to if the host allows you to access the commandline mysql tool (if they didnt remove it in the first place). Just make a connection to the server with bogus credentials, than check the error code. that will tell u if a mysql server is there, if it is ask for user credentials, and recheck the mysql server and get the version. Quote Link to comment https://forums.phpfreaks.com/topic/153934-solved-find-mysql-version-without-connection-to-database/#findComment-809035 Share on other sites More sharing options...
N1CK3RS0N Posted April 13, 2009 Author Share Posted April 13, 2009 I'll say again what I said in previous thread. There is no MySQL server information in phpinfo(). mysql MySQL Support enabled Active Persistent Links 0 Active Links 0 Client API version 5.1.30 Directive Local Value Master Value mysql.allow_persistent On On mysql.connect_timeout 60 60 mysql.default_host no value no value mysql.default_password no value no value mysql.default_port no value no value mysql.default_socket no value no value mysql.default_user no value no value mysql.max_links Unlimited Unlimited mysql.max_persistent Unlimited Unlimited mysql.trace_mode Off Off mysqli MysqlI Support enabled Client API library version 5.1.30 Client API header version 5.1.30 MYSQLI_SOCKET /tmp/mysql.sock Directive Local Value Master Value mysqli.default_host no value no value mysqli.default_port 3306 3306 mysqli.default_pw no value no value mysqli.default_socket no value no value mysqli.default_user no value no value mysqli.max_links Unlimited Unlimited mysqli.reconnect Off Off From phpinfo() Quote Link to comment https://forums.phpfreaks.com/topic/153934-solved-find-mysql-version-without-connection-to-database/#findComment-809046 Share on other sites More sharing options...
laffin Posted April 13, 2009 Share Posted April 13, 2009 That says Client API Version Not Server Version. The Client Version is not MySQL Version, its the interface PHP uses to connect to the server. Quote Link to comment https://forums.phpfreaks.com/topic/153934-solved-find-mysql-version-without-connection-to-database/#findComment-809049 Share on other sites More sharing options...
N1CK3RS0N Posted April 13, 2009 Author Share Posted April 13, 2009 That says Client API Version Not Server Version. The Client Version is not MySQL Version, its the interface PHP uses to connect to the server. Hmm.. I see.. I think overall it might be easier if I move the database page before the setup page. 1. Language 2. License 3. Setup 4. Database 5. Configure 6. Finish That's the way my steps are currently arranged. Quote Link to comment https://forums.phpfreaks.com/topic/153934-solved-find-mysql-version-without-connection-to-database/#findComment-809051 Share on other sites More sharing options...
Mchl Posted April 13, 2009 Share Posted April 13, 2009 The API version is some indication as to what MySQL server version MIGHT be installed on this host but you can not rely on it. For example, on my PC phpinfo reports API version 5.0.51, while MySQL server's version is 5.1.31 On my webhost phpinfo reports API 4.1.11 while there is no MySQL server running at this server at all! Quote Link to comment https://forums.phpfreaks.com/topic/153934-solved-find-mysql-version-without-connection-to-database/#findComment-809056 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.