Jump to content

Detecting possible database engines compatible with php installed on the compute


crabfinger

Recommended Posts

Alright I'm designing a database library so that when the user installs my application to their server it will allow you to select the database type out of a list of available database engines. Also allowing you to chose which server/database engine/database/table/format for every piece of data taken from the database, making it extremely easy to install it on a system which uses a series of database engines/databases for data carried across multiple types of applications without needing to modify files.

 

 

My current issue is generating a list of possible database engines and checking to see which ones are installed on the system and enabled through php. Any help would be much appreciated, thank-you in advance.

Link to comment
Share on other sites

Well I figured that if the user selected for example mysql then a logical step would be to try to connect using his provided input. However if the extension isn't loaded/installed then those functions aren't available unless I'm wrong at this and they are even if the extension is loaded or not but then what is their default implementation?

 

I don't fully understand what you mean by: "no reliable way of checking if/what database system is available"

Link to comment
Share on other sites

From original post

My current issue is generating a list of possible database engines and checking to see which ones are installed on the system and enabled through php.

 

On another note: Even if say ext/mysql is not available, there still may be ext/mysqli or PDO_mysql.

Link to comment
Share on other sites

On another note: Even if say ext/mysql is not available, there still may be ext/mysqli or PDO_mysql.

 

Ok yeah but you can solve that as:

 

define('MYSQL_ENABLED', function_exists('mysql_connect'));
define('MYSQLi_ENABLED', function_exists('mysqli_connect'));

 

Doesn't PDO use the mysql or mysqli extension?

Link to comment
Share on other sites

Doesn't PDO use the mysql or mysqli extension?

No. It uses its own function library.

 

Well this is all new to me till now I never have had this problem. I do find it interesting as this means that I would be able to leave the mysql and mysqli extension disabled and just include the pdo extension and still be able to connect to any (supported) database. I now understand what Mchl meant as I can check for mysql or mysqli but the problem rises when it comes to PDO as it may be enabled but provides no means to verify a mysql server is present besides instantiating PDO with the MySQL driver and check for an error but then again is it because the user mistyped the password or the lack of the mysql presence.

Link to comment
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.