PHP and MYSQL

Eric R. rossiter at discoverynet.com
Wed Jan 22 16:14:07 CST 2003


Advancewarning wrote:
> What is the trick to getting PHP to connect to MYSQL?
> 
>  
> 
> It blows up at this line:
> 
> $connection = mysql_connect("$server","$username","$password");
> 
>  
> 
> Giving me this:
> 
> *Fatal error*: Call to undefined function: mysql_connect() in 
> */web/test.php* on line *15*
> 

Well, as it was so elequently explained to me... :)

mysql_connect can't find the database that it's looking for.

Create a test page called info.php:

<?php phpinfo() ?>

Open it in your browser... you should see a block of information about 
MySQL... (my guess is, right now, it won't be there)

(If it IS there, have you loaded the default MySQL DB after MySQL 
install??  I belive that was a fix for an earlier glitch of this sort.)

If you compiled from source, run ./configure again with the --with-mysql 
option.

Depending on your location of MySQL, it would look something like:

./configure --prefix=/usr/local/php 
--with-config-file-path=/usr/local/php --with-mysql=/usr/local/mysql 
--with-apxs=/usr/sbin/apxs --enable-track-vars --enable-magic-quotes 
--enable-debugger

If you're using rpm's, good luck, never got'em to work.

Have a quality day,
E




More information about the Kclug mailing list