RE: [PHP-DB] php5 and mysql_connect
| From: | Norland, Martin | Date: | Mon, 06 Dec 2004 14:46:31 +0000 |
| Subject: | RE: [PHP-DB] php5 and mysql_connect | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-37604@lists.php.net to get a copy of this message | ||
> anyway mysql_connect() won't work in php5 - although I do believe it's
> possible to compile in the 'old' mysql lib yourself.
No, PHP5 does indeed have some new (and different) functions for mysql,
but it supports (properly, nothing old about it) the normal mysql
functions as well. The change for PHP5 is that it no longer enables
mysql functions by default (you need to now compile it with
--with-mysql), and it no longer bundles the client libraries.
From http://www.faqts.com/knowledge_base/view.phtml/aid/22154
- MySQL support. There has been some confusion with regards to the
disabling of MySQL by default in PHP 5. This simply means that in
order to use MySQL you must explictly use --with-mysql just like
you do with most every other extension. Also, the client libraries
are no longer bundled, this means you must use your MySQL sources
instead of optionally using the version that comes with PHP 4.
People can still use --with-mysql[=DIR], this move isn't a big deal.
The reason for this action is three-fold:
- MySQL 3 (which is bundled in PHP 4) : This bundled library
was no longer properly maintained.
- MySQL 4 (never bundled) : Is GPL, so doesn't fit with the PHP
license.
- PHP is attempting to bundle less third party libraries.
- Also listed in the following faq:
http://php.net/manual/faq.databases.php#faq.databases.mysql.php5
( That link doesn't work for me, without some help:
http://us2.php.net/manual/en/faq.databases.php#faq.databases.mysql.php5
)
I have to admit to not understanding exactly why mysqli functions
would be available when mysql functions aren't - seems fundamentally
wrong, unless they're somehow using a library that the php developers
themselves are actively maintaining, or someone else is maintaining and
releasing under a compatible license. Given their statement is they're
trying to bundle fewer third party libraries, that's all I can see.
The new functions for mysql are meant to be used with mysql 4.1.3+ only,
and they have some neat new things like bind variables. I can't speak
as to whether one would gain performance from using mysqli_query over
mysql_query (though I would hope one wouldn't lose it!).
Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.