LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 03-17-2004, 07:30 AM   #1
tonyboy
LQ Newbie
 
Registered: Mar 2004
Location: Vincennes, IN
Posts: 8

Rep: Reputation: 0
PHP and MYSQL on Apache


Has anybody seen, encounter, and was able to solve this error message i had when i try to access a website with php scripts connecting to a mysql database?


Fatal error: Call to undefined function: mysql_connect() in /var/www/rivet85.com/phpbb2/db/mysql4.php on line 48
 
Old 03-17-2004, 07:51 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
That could be anything unless your willing to give us line 48 of your script that its stating the error is on, etc. Probably best to give a few lines before and after just in case.

My first guess would be, its not connecting to your db for some reason, maybe mysql isn't running, the username and password is wrong that its trying to connect with, or could just be a single syntax in your line that is preventing it from connecting.
 
Old 03-17-2004, 08:06 AM   #3
tonyboy
LQ Newbie
 
Registered: Mar 2004
Location: Vincennes, IN
Posts: 8

Original Poster
Rep: Reputation: 0
[trickykid]

here is the function:

function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver;
$this->dbname = $database;

**line48** $this->db_connect_id = ($this->persistency) ? mysql_pconnect($this->server, $this->user, $this->password) : mysql_connect($this->server, $this->user, $this->password);

if( $this->db_connect_id )
{
if( $database != "" )
{
$this->dbname = $database;
$dbselect = mysql_select_db($this->dbname);

if( !$dbselect )
{
mysql_close($this->db_c
 
Old 03-17-2004, 09:42 AM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Well looking at my line 48 in my mysql4.php file I have for my phpbb forum, I see no difference in what you have in yours. This would lead me to believe mysql is not even running perhaps? Have you checked that? Check with ps -aux or top
 
Old 03-17-2004, 09:47 AM   #5
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Also on a side note, has this ever worked before or is this a initial install of phpbb, etc? If its new install, did you make sure to include mysql support with php, etc?
 
Old 03-17-2004, 09:47 AM   #6
shortfuse
Member
 
Registered: Feb 2004
Location: Texas
Distribution: Debian
Posts: 30

Rep: Reputation: 15
I have seen this before, check your phpinfo() and make sure php is built with mysql support then check your php.ini file and make sure the your loading the mysql extensions. Should look something like this

extension_dir /usr/lib/php4
extension mysql.so

Hope this helps
 
Old 03-17-2004, 09:48 AM   #7
tonyboy
LQ Newbie
 
Registered: Mar 2004
Location: Vincennes, IN
Posts: 8

Original Poster
Rep: Reputation: 0
i did a ps aux and got these entries

mysql 1188 0.0 1.4 28140 7460 ? S Mar12 0:00 /usr/sbin/mysqld
mysql 1189 0.0 1.4 28140 7460 ? S Mar12 0:05 /usr/sbin/mysqld
mysql 1190 0.0 1.4 28140 7460 ? S Mar12 0:00 /usr/sbin/mysqld
mysql 1191 0.0 1.4 28140 7460 ? S Mar12 0:00 /usr/sbin/mysqld

could it be a user and password issue?
 
Old 03-17-2004, 09:54 AM   #8
tonyboy
LQ Newbie
 
Registered: Mar 2004
Location: Vincennes, IN
Posts: 8

Original Poster
Rep: Reputation: 0
[shortfuse]

i checked my php.ini nd did not find these entries

extension_dir /usr/lib/php4
extension mysql.so

also under /usr/lib/php4, i only have ldap.so and imap.so and no mysql.so

i search the entire drive and cannot find mysql.so
 
Old 03-17-2004, 10:07 AM   #9
shortfuse
Member
 
Registered: Feb 2004
Location: Texas
Distribution: Debian
Posts: 30

Rep: Reputation: 15
Does your phpinfo() show any MySql information?
 
Old 03-17-2004, 10:20 AM   #10
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Did you post this in another forum already because I responded to that thread..
Anyway, your problem is that perl5 DOES NOT include MySQL support, nor is it bundled with the MySQL PHP library. You'll need to download the MySQL library and then recompile php using the configure option:
Code:
./configure --with-mysql
 
  


Reply


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
apache _ php +mysql rmocius@auste.e Slackware 0 03-02-2004 09:49 AM
Apache Mysql Php: mysql with php doesn't work breakerfall Linux - Networking 6 12-27-2003 08:59 PM
Apache+Mysql+php c0c0deuz Linux - Software 0 08-14-2003 02:14 PM
php-nuke with apache php mysql c0c0deuz Linux - Software 0 03-30-2003 06:23 AM
PHP, MySQL and Apache miker Linux - Newbie 1 03-27-2002 01:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:40 PM.

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