Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-06-2003, 03:58 AM   #1
Registered: Sep 2003
Posts: 30

Rep: Reputation: 15
problem with mysql and php


i'm facing a problem with my php and mysql. my mysql server is running properly and when i'm writtng script in php it's ok , but when i'm trying to connect to mysql server from a php script i'm getting :
Fatal error: Call to undefined function: mysql_connect() in /usr/local/httpd/htdocs/test.php on line 8.
here ici the code :


echo mysql_error();

when i'm running phpinfo() function i can see the that mysql is enabled (-with-mysql=shared,/usr'). is there any module i should load in the httpd.conf file or something else?
i'm a newbie, pleaz help me ?

Old 11-06-2003, 04:03 AM   #2
Registered: Dec 2002
Location: United Kingdom
Distribution: Ubuntu
Posts: 276

Rep: Reputation: 30
dont you need to ' select ' the correct database before connecting ?
Old 11-06-2003, 10:41 PM   #3
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399

Rep: Reputation: 31
Yeah, I aggree with technowax. You need a "mysql_select_db (<database name>);" line in there. Since you've defined $database, you could use "mysql_select_db ($database);".

Another problem could be that you need to put quotes around "localhost".

Hope that helps.
Old 11-07-2003, 02:50 AM   #4
Registered: Sep 2003
Posts: 30

Original Poster
Rep: Reputation: 15
Fatal error: Call to undefined function: mysql_connect()

i didn't really to intend to select any database , my probelm is that apache /php are not recognizing mysql functions while mysql server is running nicely alone as well as php /apache.

wha can i do ?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP/MySQL Problem! SpiderIRE Programming 3 10-19-2005 11:24 AM
php-mysql problem need help productive Linux - Software 1 04-28-2005 02:27 PM
Problem with MySQL 4.1.7 and PHP 5.0.2 Lars79 Slackware 4 10-28-2004 08:09 AM
Problem getting PHP to recognize MySQL, Using PHP 4.0 and MySQL 4.0.20 d2army Programming 4 06-27-2004 08:54 PM
MySQL / PHP problem jjd228 Linux - Software 5 03-15-2004 10:28 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration