PHP, MySQL, and Apache

DCT Jared Smith jared at dctkc.com
Mon Apr 22 17:03:50 CDT 2002


It's not a server name problem. PHP simply cannot find mysql;
make sure both are installed properly.

Tip #1. I searched Google for:
"Fatal error call undefined function mysql_connect"
and came up with your answer pretty quickly:

http://www.mysqldeveloper.com/faqs/index.pcgi?id=13
http://www.mysqldeveloper.com/faqs/index.pcgi?id=27

The answer at this address is a little terse, but basically,
you need to put mysql into your path so PHP can find
it. These days, PHP comes with mysql support built-in,
so you should not need to recompile; simply make
the path to mysql visible. Depends on which version of
PHP you're running...

Tip #2. Look at your [MYSQL] settings in the php.ini file,
for example:

; Default port number for mysql_connect().  If unset, mysql_connect() will
use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only
look
' at MYSQL_PORT.
mysql.default_port =

Tip #3. And, here is a little more help if you want to load mysql at
runtime!

http://www.phpbuilder.com/forum/read.php3?num=3&id=107707&thread=101850

> > Hello:
> >
> > I am experiencing some problems with a webserver I'm
> > testing at home. I built a php webpage with db
> > connectivity on a Win environment using PHPDev4 and
> > it
> > runs fine even connecting to a remote mysql sever.
> > Now, I uploaded this page to the webserver which is
> > also running mysql server on a RedHat 7.2 machine
> > and
> > I can't get the page to load correctly. This is the
> > message I get:
> >
> > Fatal error: Call to undefined function:
> > mysql_connect() in
> > /var/www/html/domainName/Maintain/db_connect.php on
> > line 13.
> >
> >
> > I changed the servername to localhost but still
> > can't
> > connect.
> >
> > Is there some specific configuration that need to be
> > done on Linux in order to get php and mysql to work
> > side-by-side?
> >
> > Note:
> > The apache server is a fresh RPM install.
> >
> > Thanks in advance for all your help.




More information about the Kclug mailing list