LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   PHP not supporting mysql_connect() (https://www.linuxquestions.org/questions/linux-server-73/php-not-supporting-mysql_connect-635506/)

sunils1973 04-15-2008 10:18 AM

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

msound 04-15-2008 12:28 PM

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!

sunils1973 04-16-2008 09:21 AM

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?

msound 04-16-2008 10:15 AM

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!

eaglek96 04-16-2008 08:48 PM

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.

sunils1973 04-17-2008 11:22 AM

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?


All times are GMT -5. The time now is 09:55 PM.