Mysqli support - test or complain?
| From: | Dave M G | Date: | Mon, 10 Dec 2007 08:16:02 +0000 |
| Subject: | Mysqli support - test or complain? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-265597@lists.php.net to get a copy of this message | ||
PHP List,
Based on what seemed to be good advice to switch to using mysqli for interacting with a MySQL database, I built a content management system that uses mysqli for all it's calls.
It works great on a lot of my servers. However, I just discovered that one web hosting service I use does not have mysqli enabled. I ran the phpinfo() command and they are running 5.2.5, but the configure command does not contain "--with-mysqli".
I would like the scripts I've written to be somewhat portable, but I'm unsure of whether or not I should assume that mysqli is in use.
I see it as being a situation of essentially two options.
One is based on the assumption that mysqli is as likely not to be available as it is to be installed. In this case I should write my scripts to test whether it exists and then use either mysqli or straight mysql commands as appropriate. If this is the way to go, what do I do to test for the existence of mysqli from within a PHP script?
The other is to assume that recent installs and upgrades of PHP > 5 should have mysqli because that's the currently preferred way of doing things, and therefore I should contact the web host and ask that they install it, or I find a different host.
Which assumption should I be proceeding with?
Thank you for any advice or assistance.
--
Dave M G