Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to connect to mysql from php, it says i have not configured mysql-php, call to undefined function:mysql_connect();. My server is not registered with RHN, hence i cannot yum install php-mysql. How do i configure php-mysql connection without yum install. Thanks.

cat /etc/*-release

Red Hat Enterprise Linux Server release 5 (Tikanga)

rpm -qa |grep php |grep mysql


rpm -qa | grep -i php


netstat -vat |grep sql

tcp        0      0 *:mysql                     *:*                         LISTEN  


system: Linux 2.6.18-8.el5xen #1 SMP Fri Jan 26 14:29:35 EST 2007 x86_64

Configure Command

'./configure' '--build=x86_64-redhat-linux' '--host=x86_64-redhat-linux' '--
 target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-  
  prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--
datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--
libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--
mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' 
'--    with-
libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '-    -
disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' 
'--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-
 native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-
dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-
pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-
magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' 
'--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos'
 '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-
shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--with-mime-
magic=/etc/httpd/conf/magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--
with-apxs2=/usr/sbin/apxs' **'--without-mysql' '--without-gd' '--without-odbc'** '--disable-dom'
 '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-

'--without-mysql' '--without-gd' '--without-odbc'

how to --with-mysql

share|improve this question
up vote 2 down vote accepted

You don't need to resompile if you've got dynamic loading support enabled.

You've already got the php-mysql rpm installed - so either it's not configured properly your php.ini or it has dependencies which have not been installed (which is a tricky scenarion to create).

running rpm --verify php-mysql will perform some basic checks in the install.

rpm -q -l will list the files in the rpm:

[symcbean@example ~]$ rpm -q -l php-mysql

Check these files exist and are readable by your webserver uid (rpm -q -l php-mysql | xargs ls -l).

Check that the location of the php modules matches the extension_dir in your php.ini, which should also have dl enabled. NB use phpinfo() to findout where your php.ini is located.

The EPEL service provides third party add-ons to RHEL, not the RH supplied packages. But you can download individual rpms (if you have a current RHEL subsription from If you don't have a subscription (and therefore you're not bothered about RH support), the Centos rpms should be binary compatible (see link for dependencies). There are also other people providing RH compatible rpms (try rpm search)

share|improve this answer

You should look into installing the EPEL repository for your release of RedHat. This is going to be way easier to maintain than starting to compile software from sources.

See :

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.