Programming C# C++ (7) Delphi (617) Java (8) JavaScript (31) perl (9) php (4) GTK (2) VBScript (1) Visual Basic (1)
Exchange Links About this site Links to us 
|
Fatal error: Call to undefined function: mysql_connect()
38 comments. Current rating: (12 votes). Leave comments and/ or rate it.
Question: I install Apache, php 4.1.2 and mysql on RedHat Linux. When calling a php script that connects to the mysql database, I get this error message:
Fatal error: Call to undefined function: mysql_connect()
in /var/www/html/buyersguides/global/system_globals.inc on line 12
Answer: Most likely mysql is not enabled on your php installation. You configured this when you compiled the php sources.
Create a dummy HTML page on your web server with the php code from below and call it through the web browser. It will tell you if mysql is enabled. (If you do not see a table with parameters for mysql, then mysql is not enabled in your php build.)
How do I enable mysql in my php installation?
If you have an RPM based system like Mandrake, then you need to install package php-mysql-4.3.2-3mdk.i586.rpm. You may need to resolve the requirement of libmysql12 - these are shared libraries needed to dynamically load and use MySQL.
Visit libmysql on rpmfind.net and get the RPM there.
Install it all then with and restart Apache:
[root]#ls *.rpm
-rw-r--r-- 1 nobody nogroup 22333 Jul 26 2004 php-mysql-4.3.2-3mdk.i586.rpm
-rwxr--r-- 1 nobody nogroup 263560 Aug 9 10:55 libmysql12-4.0.23-2mdk.i586.rpm
[root]#rpm --install libmysql12-4.0.23-2mdk.i586.rpm
warning: libmysql12-4.0.23-2mdk.i586.rpm: V3 DSA signature: NOKEY, key ID 70771ff3
[root]#rpm --install php-mysql-4.3.2-3mdk.i586.rpm
warning: php-mysql-4.3.2-3mdk.i586.rpm: V3 DSA signature: NOKEY, key ID 70771ff3
[root]#apachectl -k restart
On a system that is not based on RPM installation you need to go to your php installer directory and call configure to create a new make file, then recompile:
# ./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql
# make
# make install
At the end do not forget to restart Apache.
Comments:
| You are on page 3 of 3, other pages: 1 2 [3] | |
|
|
|
I had the same problem and none of the solutions from the web helped me.
I fixed it by myself.
It is caused by the fact that the PHP path is set in the Path system variable. However, before restarting Apache with the new system variable, the dll cannot be found. The solutions are: 1. restart the computer 2. shutdown apache, open a new command window and run httpd.exe (Please notice that restarting Apache server using Apache Monitor does not work, because Apache Monitor is still using the same Path environment variable)
|
|
|
|
Hi Everyone, I Spent over 6 hours trying to figure out how to stop this error and how to connect to the database. I checked about 20 forums trying to apply their steps to make the PHP identify the MYSQL functions... at last nothing Helped so my friend told me 'man just install XAMPP and it will do everything for you' , I Installed it .. it needs 0 configuration .. Really you dont have to do anything except creating ur database so If you are confused just go to this website > http://www.apachefr..s.html<
I am sure that it will work 100%
|
|
|
|
|
Hello,
after fighting and fighting I found that the problem was that I had my PHP App installed under Program Files !!
I uninstalled, and reinstalled under C:\ and there you go.. no more errors !!
Thanks all !!
|
|
|
|
|
Thanks riza - that did the trick for me!
|
|
|
|
|
I solved my problem by copy libmySQL.dll to windows\system32 directoty after setting up correct extension directive and uncomenting adequat extensions in proper php.ini file.
|
|
|
|
|
just tell me what to do with what file to run mysql with PHP and Apache if you are sure. Because I am doing the things but can't connect to mysql.
Where/what to set its port or other things in what file.
I shall be thankful.
|
|
|
|
|
Step #6 of the list below SOLVED it for me. If you have Apache installed to c:\www\, and php installed to c:\www\php\ then:
1. Copy php.ini-dist to php.ini
2. Edit php.ini
3. Check line: doc_root = 'c:\www\htdocs'
4. Check line: extension=php_mysql.dll
5. Check line: extension_dir = './ext'
6. Copy libmysql.dll to C:\WINDOWS
1. Control Panel > System > Advanced > Environment Variables
2. Edit 'PATH' variable, and append ';C:\www\php' or set 'C:\www\php' alone.
3. Click Okay.
|
|
|
|
|
Hi all,
This thread helped me a lot.
Really nice.
Thanks a lot.
Regards,
Ankzz
|
| You are on page 3 of 3, other pages: 1 2 [3] |
|