Mysql Problems

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
cjermain
Forum Newbie
Posts: 12
Joined: Wed Jun 01, 2005 6:11 pm

Mysql Problems

Post by cjermain »

Im running my IIS on my windows XP machine and I have recently installed PHP and MySql. However when I attempt to open a database:

$db=mysql_connect("localhost", "root","**EDITED**");

I recive an error:

Fatal error: Call to undefined function mysql_connect()

When I looked further by using phpinfo() I am not able to find any mention of MySql. I have tried reinstalling MySql, and nothing has changed. Any idea of what my problem is??

Thanks!
-Colin J
wyred
Forum Commoner
Posts: 86
Joined: Mon Dec 20, 2004 1:59 am
Location: Singapore

Post by wyred »

What version of PHP did you install?

If you downloaded version 5, note that the mysql libraries are no longer included. Here's the link.

http://www.php.net/manual/en/migration5.databases.php
There were some changes in PHP 5 regarding databases (MySQL and SQLite).

In PHP 5 the MySQL client libraries are not bundled, because of license problems and some others. For more information, read the FAQ entry.

There is also a new extension, MySQLi (Improved MySQL), which is designed to work with MySQL 4.1 and above.

Since PHP 5, the SQLite extension is built-in PHP. SQLite is an embeddable SQL database engine and is not a client library used to connect to a big database server (like MySQL or PostgreSQL). The SQLite library reads and writes directly to and from the database files on disk.
User avatar
cjermain
Forum Newbie
Posts: 12
Joined: Wed Jun 01, 2005 6:11 pm

Post by cjermain »

Yea, I have PHP Version 5.0.4. I will look into that problem.
User avatar
cjermain
Forum Newbie
Posts: 12
Joined: Wed Jun 01, 2005 6:11 pm

Post by cjermain »

I found the error as addressed by MySql

Site http://dev.mysql.com/doc/mysql/en/php-problems.html

"Error: "Fatal error: Call to unsupported or undefined function mysql_connect() in .." This means that your PHP version isn't compiled with MySQL support. You can either compile a dynamic MySQL module and load it into PHP or recompile PHP with built-in MySQL support. This is described in detail in the PHP manual. "


How do I "recompile PHP with built-in MySQL support"?
Thanks!
-Colin J
wyred
Forum Commoner
Posts: 86
Joined: Mon Dec 20, 2004 1:59 am
Location: Singapore

Post by wyred »

If you don't know anything about compiling, I would suggest you downgrade to PHP4, which has support for MySQL.

You can check out this link on how to compile it on a Windows system. I only took a glance and I think it does not teach you how to compile it with MySQL support.
http://www.php.net/manual/en/install.wi ... ilding.php
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

All you need to do is uncomment
;extension=php_mysql.dll
User avatar
cjermain
Forum Newbie
Posts: 12
Joined: Wed Jun 01, 2005 6:11 pm

Post by cjermain »

hey that works!!!!!!!!!!!!!

thanks!!!
-Colin J
User avatar
Mastermind
Forum Commoner
Posts: 36
Joined: Thu Mar 10, 2005 2:38 am
Location: CDO,Philippines
Contact:

Post by Mastermind »

That also my problem.
wyred
Forum Commoner
Posts: 86
Joined: Mon Dec 20, 2004 1:59 am
Location: Singapore

Post by wyred »

timvw wrote:All you need to do is uncomment
;extension=php_mysql.dll
Hi Tim, does this mean PHP5 comes with MySQL support just that it's disabled by default?

I haven't tried PHP5, still sticking with 4.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

does this mean PHP5 comes with MySQL support just that it's disabled by default?
correct.
wyred
Forum Commoner
Posts: 86
Joined: Mon Dec 20, 2004 1:59 am
Location: Singapore

Post by wyred »

:o

Alright, thanks. :)
Post Reply