LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-15-2008, 10:18 AM   #1
sunils1973
Member
 
Registered: Jan 2007
Location: INDIA
Distribution: Ubuntu, Debian
Posts: 340

Rep: Reputation: 30
PHP not supporting mysql_connect()


I have installed debian etch and apache

later downloaded and installed mysql and it is working

PHP is also working

but when i write code to connect to the mysql
i.e $conn=mysql_connect("localhost","root","")

Fatal error: Call to undefined function: mysql_connect() in /var/www/apache2-default/sal.php on line 8

where is the problem?

is it with apache? mysql? PHP?

is is required to apache get compiled after the installation of mysql
to support mysql libraries?

the mysql is a binary (tgz) version (not source code) which i installed
 
Old 04-15-2008, 12:28 PM   #2
msound
Member
 
Registered: Jun 2003
Location: SoCal
Distribution: CentOS
Posts: 465

Rep: Reputation: 30
Have you installed the php-mysql package? Try running:
Code:
aptitude install php-mysql
as root at the command line.

I'm not a debian user so if that doesn't work try agt-get instead of aptitude.

Cheers!
 
Old 04-16-2008, 09:21 AM   #3
sunils1973
Member
 
Registered: Jan 2007
Location: INDIA
Distribution: Ubuntu, Debian
Posts: 340

Original Poster
Rep: Reputation: 30
I don't like to lean towards a particular distro

that is why i installed downloaded mysql from tar binary though it is possible to install it from the installation cd. I would like to do things in a standardised way - i.e The solutions should be applicable to every distro (for example getting packages in tar form is acceptable to all distros also compiling them is acceptable to all systems)

How ever I understand that for my problem, the package mysql_php should be installed. I shall try that way

But why it is required? What is its function?
 
Old 04-16-2008, 10:15 AM   #4
msound
Member
 
Registered: Jun 2003
Location: SoCal
Distribution: CentOS
Posts: 465

Rep: Reputation: 30
Quote:
The php-mysql package contains a dynamic shared object that will add
MySQL database support to PHP.
- http://rpmfind.net//linux/RPM/fedora....5-6.i386.html

Cheers!
 
Old 04-16-2008, 08:48 PM   #5
eaglek96
LQ Newbie
 
Registered: Feb 2008
Location: Massachusetts
Distribution: Debian Linux and FreeBSD
Posts: 12

Rep: Reputation: 0
How did you install the PHP? Did it get compiled with mysql support? If you're using Debian, generally you apt-get php5-common, then install php5-mysql. It's not enabled by default (I don't think anyhow).

If you didn't install php from a package manager, you may need to enable it in the php source during the configure stage (although I thought this was now enabled by default).

Since there are so many extensions available for PHP, they only enable certain ones by default, and you enable/disable the ones you need.
 
Old 04-17-2008, 11:22 AM   #6
sunils1973
Member
 
Registered: Jan 2007
Location: INDIA
Distribution: Ubuntu, Debian
Posts: 340

Original Poster
Rep: Reputation: 30
Yes : the posting done by eaglek96 is close to my doubt

During configurations set up, we have to enable it.

My doubt is that much enough?

Is there anything I have to do with apache (means recompilation)

What is the order of installation

Apache, Mysql, php?
 
  


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
mysql_connect crashes php DavidHB Slackware 4 04-18-2007 08:06 AM
php mysql_connect error compu73rg33k Linux - Software 11 04-02-2005 05:37 AM
PHP mysql_connect Guru - Install Question/Issue whohasit Programming 4 07-16-2004 06:28 PM
mysql_connect problem w/apache+php CodeCrush Linux - Software 0 05-24-2004 08:35 AM
Redhat PHP 4.2 Problem, no mysql_connect() nehalem Linux - Software 1 11-20-2003 12:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:46 AM.

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