[Sussex] FC5 - PHP not connecting to MySQL

Ronan Chilvers ronan at thelittledot.com
Fri May 5 10:02:48 UTC 2006


Hi Brendan

On Fri, 5 May 2006 10:30:06 +0100
"Brendan Whelan" <b_whelan at mistral.co.uk> wrote:

> 
> Ronan, thanks for the response.
> 
> A bit more info 'yum search php-mysql' lists the module.
> 
> I can connect to the database, in a terminal window, using a
> username/password

MySQL is up and running then.

> 
> <?php
> $connect = mysql_connect("localhost", "root", "mypassword) or die
> ..................................
> ?>
> 
> Gives call to undefined function mysql_connect

The mysql module isn't loaded then.

> 
> As in the earlier email: phpinfo shows that PHP was built
> "--without-mysql" which I think could be the clue.

Ah! That implies that you are using the fedora provided
package, not the source built one. Package distributors usually turn
off the extensions and then compile them separately as modules for
distribution, which is probably why you're getting that configure
line.  Does the configure line show loads of other flags that you
didn't pass to your configure command?

You have a couple of choices here.  You can either install the
php-mysql module using yum which will plug into your current
configuration and should 'just work'.

Or you can compile from source, which will mean you need to configure
apache to point to your new build of php, rather than the fedora
package.

Unless you particularly want to compile PHP from source I would use the
yum version.  If you want to use a different version of PHP than the
one provided by Fedora, then compile from source.

> 
> Where should I execute "./configure --with-mysql=shared" and where
> will the mysql.so file be created?

It will be created in a folder within $PREFIX/lib/php/extensions once
you've run make install, where $PREFIX is the installation prefix you
(optionally) give to the configure script.

If you want to do the compile rather than use the fedora package, let
me know and I can tell you how I go about compiling and installing PHP.

Cheers
-- 
Ronan
e: ronan at thelittledot.com
t: 01903 739 997

This email has been digitally signed using GNUPG to verify the identity
of the sender. Please see http://www.gnupg.org/ for further information.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20060505/f835d8a3/attachment.pgp 


More information about the Sussex mailing list