Fatal error: Call to undefined function mysql_connect
Jeffrey F. Bloss
jbloss at tampabay.rr.com
Tue Feb 13 17:11:35 UTC 2007
Patrick Newberry wrote:
> --> What error exactly?
> I'm getting the error message
> Fatal error: Call to undefined function mysql_connect
> When trying to bring a php page up and with code to connect to a mysql
> database.
I later realized your subject line included the error. My bad for not
being more on the ball, but it's generally not advisable to include
message content in the Subject: header. ;)
That's typically an indication php5-mysql isn't installed, but you
specifically said you had installed it. There's also a php5-mysqli (the
"improved" version), but that too should have been installed as a
dependency. It might not hurt to double check though.
[...]
> Well when I finished Then I could not open my php script in either
> opera or firefox! Well at least it was consistant!
>
> I when to the apache2.conf file and commented out this line
>
> AddType application/x-httpd-php .php
>
> Then did the restart of apache but still I php scripts are not
> executing.
Yes. Without being aware of a .php MIME type Apache has no idea what to
do with those files. This is actually one way to globally disable
execution of PHP for security reasons if you plan to selectively
enable PHP later. There's also some entries in /etc/mime.types
and /etc/apache2/mods-enabled/php5.conf. ;)
>
> Not sure if this means anything, but when I do the apache restart I
> get the message:
> * Forcing reload of apache 2.0 web server... apache2: Could not
> determine the server's fully qualified domain name, using 127.0.0.1
> for ServerName
What do 'hostname' *and* 'hostname -f' output? They should both be the
same, and ideally a fully qualified domain name (FQDN) as you've set up
in /etc/hosts. You may also have to edit /etc/hostname to reflect your
server's full name. Even if you don't have an "official" domain you
should set up something and make it consistent to prevent these errors
and give things like MySQL a "reference point" from which to work. A
server really does need a unique name or all sorts of strangeness can
occur.
[...]
Since you can log in, create and query databases, etc... we'll assume
MySQL is *mostly* OK for now. ;)
> > What's your /etc/mysql/my.cnf file have in it for a bind-address?
> >
> My bind address is the standard 127.0.0.1
I'd open up /etc/mysql/my.cnf and comment out the bind address line, at
least for now. It will allow MySQL to listen on all interfaces and
maybe fix up your problems connecting with one browser and not another.
There may be differences in how "localhost" is resolved between various
softwares that this, and/or a strictly configured host name, would
address.
> anyway here is the netstat -tap results.
>
> Active Internet connections (servers and established)
> Proto Recv-Q Send-Q Local Address Foreign Address
> State PID/Program name
> tcp 0 0 localhost:mysql *:*
> LISTEN -
Yes. This reflects the bind address in my.cnf. If for some reason
Apache is resolving your machine name as something like
localhost.localdomain (a default in /etc/hosts I believe) it might be a
problem.
> Anyway, I guess number one issue I'll look at tommorow is why php
> scripts are not being recognized by my browser but html files (via
> localhost) are being recognized.
That's pretty obvious... you've told Apache to "ignore" them. ;) So out
of curiosity what is the Apache2 default? To display the file as text
or offer it up for download? <grin>
--
_?_ Outside of a dog, a book is a man's best friend.
(o o) Inside of a dog, it's too dark to read.
-oOO-(_)--OOo------------------------------[ Groucho Marx ]---
http://wrench.homelinux.net/~jeff/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 892 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20070213/9b86ec76/attachment.sig>
More information about the ubuntu-users
mailing list