PHPBuilder - Getting MySQL to Work with PHP

RSS Twitter

Getting MySQL to Work with PHP

by: Suneel Kanuri
December 29, 2003

To get MySQL to work with the PHP 5 copy /dll/libmySQL.dll to the directory where php 5 resides and copy the /extensions/php_mysql.dll to the directory where php.exe resides.(if you can't find the two above files probably you are using an old release of PHP 5. You should check for latest at: <a href="" target="_blank"></a>)

In additon uncomment extension line in php.ini and add the following code to a gnereal database file(dbcon.php) in my case and include it in each file which needs access to database.

if (!class_exists('mysql')) {
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')

I tried to eliminate above code and leave php_gtk.dll in extensions directory. But it didn't work shouting the familiar dialouge: Unable to load ......

The Other way around is using ODBC driver for MySQL which can be downloaded from:

<a href="" target="_blank"></a>

and remember PHP requires a system DSN.

For *nix users you need to link the PHP to a driver manager library at configure and compile time. You can obtain an ODBC driver manager from OpenLink Software(LGPL/BSD Licenses) from

<a href="" target="_blank"></a>

So good luck coding..

Suneel Kanuri

Comment and Contribute

Your comment has been submitted and is pending approval.

Suneel Kanuri



(Maximum characters: 1200). You have characters left.