Page 1 of 1

Enabling MySQL in PHP

Posted: Sat Jan 29, 2005 10:48 pm
by froth
While configuring phpBB, the install tool told me that MySQL isn't enabled in PHP. I've spent the better part of today installing Perl, PHP, and Python on my new Apache2 server and I guess I just kind of thought that PHP had mysql enabled out-of-the-box. So, what do I add to php.ini (if that's what I do at all) to "enable" mysql in php?

Posted: Sat Jan 29, 2005 10:57 pm
by feyd
I would guess you installed php5, in which case, that's correct php5 does not support MySQL out of the box. You'll have to either enable the mysql or mysqli api's to get that functionality.

Posted: Sat Jan 29, 2005 11:03 pm
by froth
Well, all the knowledge I have on the subject is uncommenting items from that list of extensions in php.ini :wink:

A comment in php.ini tells me "Note that MySQL and ODBC support is now built in, so no dll is needed for it."

So... how do I enable it? Is it a special switch somewhere?

And yes, I have all the most updated software (everything was redownloaded and reinstalled this afternoon).

Posted: Sun Jan 30, 2005 12:00 am
by timvw
php.ini (i want both extensions :))
extension=php_mysql.dll
extension=php_mysqli.dll

in my path (environment variable)
C:\Program Files\mysql\MySQL Server 4.1\bin;C:\Program Files\php-5.0.3-Win32

-> after a reboot everything worked just fine

Posted: Sun Jan 30, 2005 1:07 pm
by froth
I don't have those DLLs, they didn't come with the installation. Again I say:

"Note that MySQL and ODBC support is now built in, so no dll is needed for it."

Is there some way to enable it without doing the extension=blah.dll thing?

Posted: Sun Jan 30, 2005 3:34 pm
by feyd
as we've said, if this is php5, mysql support is NOT built in... no matter what the ini's comments say.

So, is this php5 or php4? Both are currently active and highly available, so we can't tell which one you have installed.

Posted: Sun Jan 30, 2005 3:51 pm
by froth
yes I have php version 5.

Posted: Mon Jan 31, 2005 12:56 am
by timvw
currently i'm using php5.0.3 and i could nowhere find such a thing on mysql being built in in the php.ini-dist and php.ini-recommended.

the only thing i found, in install.txt (can't find README.txt)
Note: In PHP 4.3.1 BCMath, Calendar, COM, Ctype, FTP, MySQL, ODBC,
Overload, PCRE, Session, Tokenizer, WDDX, XML and Zlib support is
built in. You don't need to load any additional extensions in order
to use these functions. See your distributions README.txt or
install.txt or this table for a list of built in modules.
in snapshot.txt i can't find it either
Built-in Extensions
===========================
bcmath
calendar
com_dotnet
ctype
ftp
iconv
odbc
pcre
session
SPL
SQLite
standard
tokenizer
zlib
libxml
dom
SimpleXML
wddx
xml

The following means you should add a directory to your path where it can find libmysql.dll (%mysql%\bin)
Module: php_mysql.dll
===========================
libmysql.dll

Module: php_mysqli.dll
===========================
libmysql.dll

Posted: Tue Feb 01, 2005 6:52 am
by froth
I got it working (finally) by copying php_mysql.dll and php_mysqli.dll (i downloaded them) to c:\windows and c:\windows\system32, as well as the apache ext folder and adding my own extension=php_mysql.dll lines in php.ini... and it seems to be working ok. However, the phpbb installation still hangs. It says that it took 30 seconds to process a mysql line.

Posted: Tue Feb 01, 2005 2:57 pm
by timvw
always get the zip distribution of php... because the one with installer doesn't have all those nice extensions etc included (at least i think it doesn't)

Posted: Wed Feb 02, 2005 3:00 pm
by froth
That's right; I had to download the zip to get php_mysql.dll x_x