Fatal error: Call to undefined function mysql_connect() in C

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

You appear to have the correct php -m listing. Question, did you copy the config.php.dist over your existing config.php and then change your database settings? I would suggest you give that a shot. Dollars to doghnuts that's your problem.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
METZ-Germany
Posts: 3
Joined: Fri Apr 29, 2005 3:33 am

Post by METZ-Germany »

Hi,

yes I have copy the config.php.dist to config.php.

But what you mean with : Databank Seetings ?

Best regards

Peter
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

database name, database host, database userid, database password.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
METZ-Germany
Posts: 3
Joined: Fri Apr 29, 2005 3:33 am

Post by METZ-Germany »

:D Thanks, now it´s work
voskewarez
Posts: 5
Joined: Fri May 13, 2005 9:08 am

Post by voskewarez »

Well, i have the same problem...
I don't understand why this is happening, tried to reinstall it 3 times.
Every time i get the same error.

I've checked the config.php file, all seems to be correct.
What else can be the problem????
Please...this has taken me 3 days ... still no go.

p.s., running op Windows XP SP2....
Activeperl 5.8.6.811
Apache 2.0.52
Cacti-0.8.6d
cactid-0.8.6c
mysql 4.0.24
php 5.0.4
rrdtool 1.0.48
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Make sure that mysql.so is loading in you php.ini file.. ;)

You can see if it is by running "php -m" and looking for mysql.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
voskewarez
Posts: 5
Joined: Fri May 13, 2005 9:08 am

Post by voskewarez »

I've also done that....the complete list is there (seen it on other postings)
mysql is on the list :D
LeonT
Posts: 8
Joined: Mon May 09, 2005 2:12 am

Post by LeonT »

I've had the same problem, but I managed to solve it.
If i remember how befor my next workday (thursday), I'll post it.
[edit]
I believe it had something to do with copying one or two mysql files from the php\bin(or something like that) dir to the php root dir.
bthomas
Posts: 4
Joined: Mon Nov 15, 2004 10:56 pm
Location: Southern Cross University

php mibs dir

Post by bthomas »

Hi

In the current version of (windows) php (5.0.4) the mibs dir is now located in C:\php\extras\mibs

Regards

Bernard
voskewarez
Posts: 5
Joined: Fri May 13, 2005 9:08 am

Post by voskewarez »

SO...what do i have to change ????
bthomas
Posts: 4
Joined: Mon Nov 15, 2004 10:56 pm
Location: Southern Cross University

MIBSDIR

Post by bthomas »

Hi

Just need to change the MIBSDIR path to reflect this.

MIBSDIR=c:\php\extras\mibs

Regards

Bernard
voskewarez
Posts: 5
Joined: Fri May 13, 2005 9:08 am

Post by voskewarez »

That i already have in my system variables.....so no change in my situation..... what else can i do???
voskewarez
Posts: 5
Joined: Fri May 13, 2005 9:08 am

Post by voskewarez »

In the other topic i saw the answer.....
i misplaced the environment variables.......now it is working :D
thanx all
sunnybaba
Posts: 1
Joined: Tue Jun 14, 2005 1:39 am
Contact:

Re: Fatal error: Call to undefined function mysql_connect()

Post by sunnybaba »

djektro wrote:Hello,

Really help me please....
2 weeks I'm working on it and i've always this error :

Fatal error: Call to undefined function mysql_connect() in C:\Apache2\htdocs\cacti\lib\adodb\drivers\adodb-mysql.inc.php on line 338

The reason it happens is because PHP5 does not provide built-in
support for MySql (like PHP4 and below did).
The PHP5 installer has several DLL files missing.
Here's a webpage with a fix for the problem.
http://www.siteinaweek.com/installphp5/howto.php
It also provides the missing DLL files as a free download.
I have pasted everything from the page between blue dotted lines below.
If you can't view it correctly, better to visit the above link

-----------------------------------------------------------------------------------

Why the error happens:

PHP4 (and below) has MySQL support included by default; the functions are embedded into the core of PHP. But PHP5 has removed embedded support for MySQL and requires MySQL to be loaded as an add-in module, in the same way you have to support anything else. More info can be found the PHP5 Migration FAQ and the Database Issues FAQ.


--------------------------------------------------------------------------------

If you are using Windows XP with IIS
After downloading and installing the PHP 5.0.4 installer ...
1. Open the php.ini file and make the following changes to its contents (php.ini is a text file and resides in C:\WINNT)


Change this : ;extension=php_mysql.dll
to : extension=php_mysql.dll
(the semicolon at the start is removed)
Then give the correct path to the extensions directory
extension_dir = "C:\Program_Files\php\morephp"
(in my case I created a directory called 'morephp' to store all the extensions. If your directory is called 'extensions' the line would be
extension_dir = "C:\Program_Files\php\extensions")


--------------------------------------------------------------------------------


2) Then copy the following files in to the morephp directory (as I have mentioned above, morephp is a name I gave to a directory into which I dump all the extensions):

php_mysql.dll
php_mysqli.dll

The 2 files are available for download here

And... you should live happily ever after!

Remember to restart IIS before viewing pages.


--------------------------------------------------------------------------------

3) Should you still face problems try this. Copy the following files

libmysql.dll
libmysqli.dll

in to
c:\windows\system32

The 2 files are available for download here


--------------------------------------------------------------------------------


4) Still does not work? Try this slightly radical step.
Here is a dump of all the dll files you would possibly need for PHP5 installation. Simply copy all the files from this directory in to your morephp directory.


--------------------------------------------------------------------------------

If your php files simply do not show up on IIS, then check out this tutorial for installing php in IIS, and see what tweaking you need to do. The tutorial is about PHP4, but the fundamentals are the same.

--------------------------------------------------------------------------------

If you are using Windows XP with Apache
If you are using Apache instead of IIS, copy the following files

php5apache2.dll
php5ts.dll
php_mysql.dll
libmysql.dll
libmysqli.dll

in to

c:\windows\system32

The 5 files are available for download here

Restart Apache before you view the pages.

Here is another tutorial for installing Php5 in XP and Apache.

-----------------------------------------------------------------------------------
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

WRONG WRONG WRONG!!!!!!!!!

Read the PHP installation manuals. They recommend that you place the following in your path:

"C:\PHP;C:\PHP\EXT" (assuming you are using c:\php as your installation folder)

or

"C:\PHP;C:\PHP\EXTENSIONS"

The choice depends on whether you are using PHP 4 or 5.

Also, keep your PHP.INI file in C:\PHP and set the following environment variable:

PHPRC=C:\PHP

Unless you have multiple versions of PHP running on your system, this is the way you should configure PHP. The PHP Group abandoned the recommendation to move files to C:\WINDOWS\SYSTEM32 several releases ago.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests