Results 1 to 4 of 4

Thread: php & mysql mysql_connect() error

  1. #1
    Junior Member
    Join Date
    May 2006
    Posts
    1

    php & mysql mysql_connect() error

    I'm running a basic script to connect to a mysql database in PHP. PHP works fine but if I try to connect to a mysql database
    I get the error:
    "Fatal error: Call to undefined function mysql_connect() in /home/david/public_html/php/do_mysql.php on line 9"
    I installed php5-mysql
    Googling around I got the suggestion that this may be because PHP was not compiled with mysql support built in. Can anyone confirm this?

  2. #2
    Senior Member registered user
    Join Date
    Aug 2003
    Posts
    126
    Hi davidh,
    It is certainly possible for this to be a reason for you to get the error you describe.
    You can usually check the PHP configuration script using the phpinfo(); function.
    This should give you output something like below (amongst other things):
    Command '../configure' '--prefix=/usr' '--with-apxs=/usr/bin/apxs' '--with-config-file-path=/etc/php4/apache' '--enable-memory-limit' '--disable-debug' '--with-regex=php' '--disable-rpath' '--disable-static' '--with-pic' '--with-layout=GNU' '--with-pear=/usr/share/php' '--enable-calendar' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-bcmath' '--with-bz2' '--enable-ctype' '--with-db4' '--with-iconv' '--enable-exif' '--enable-filepro' '--enable-ftp' '--enable-dbase' '--with-gettext' '--enable-mbstring' '--with-pcre-regex' '--enable-shmop' '--enable-sockets' '--enable-wddx' '--enable-tokenizer' '--disable-xml' '--with-expat-dir=/usr' '--with-xmlrpc' '--enable-yp' '--with-zlib' '--without-pgsql' '--with-kerberos=/usr' '--with-openssl=/usr' '--with-zip=/usr' '--enable-dbx' '--with-mime-magic=/usr/share/misc/file/magic.mime' '--with-exec-dir=/usr/lib/php4/libexec' '--without-mm' '--with-curl=shared,/usr' '--with-dom=shared,/usr' '--with-dom-xslt=shared,/usr' '--with-dom-exslt=shared,/usr' '--with-zlib-dir=/usr' '--with-gd=shared' '--enable-gd-native-ttf' '--with-jpeg-dir=shared,/usr' '--with-xpm-dir=shared,/usr/X11R6' '--with-png-dir=shared,/usr' '--with-freetype-dir=shared,/usr' '--with-mcrypt=shared,/usr' '--with-ming=shared,/usr' '--with-gmp=shared,/usr' '--with-imap=shared,/usr' '--with-imap-ssl' '--with-ldap=shared,/usr' '--with-mcal=shared,/usr' '--with-mhash=shared,/usr' '--with-mysql=shared,/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-pgsql=shared,/usr' '--with-pspell=shared,/usr' '--with-unixODBC=shared,/usr' '--with-recode=shared,/usr' '--enable-xslt=shared' '--with-xslt-sablot=shared,/usr' '--with-snmp=shared' '--with-sybase-ct=shared,/usr' '--with-ttf=shared,/usr' '--with-t1lib=shared,/usr'

    The bit you are interested in is the --with-mysql=...
    If this isn't present then MySQL support is not compiled in.
    With Knoppix PHP has MySQL support compiled in, but many Linux distros don't.
    What Linux distro are you running?
    Regards,
    Mark Preston

  3. #3
    Junior Member
    Join Date
    Sep 2006
    Posts
    1
    I can second this problem. Amazing as it may sound, MySQL support does not seem to be compiled into the PHP configuration that comes with KNOPPIX 5.0.1 (the CD version). The phpinfo() function does not list the mysql module as installed.

    Furthermore, I get strange problems with blank web pages being displayed when trying to start up the Apache2 webserver and surfing to http://localhost. I can't get the webserver to properly serve any HTML page that I place in /var/www (which is the DocumentRoot). A simple PHP file with a call to phpinfo() works, however. MIME/file type problem?

    Getting PHP to work in KNOPPIX ought to not be harder than cleanly booting KNOPPIX, starting up MySQL, Apache, and then serving a PHP page with proper MySQL code in it. But this does not work in 5.0.1 (whereas it did in earlier versions, with one or two configuration tweaks), and for me that is a major grievance.

  4. #4
    Senior Member registered user
    Join Date
    Aug 2003
    Posts
    126
    Hi Domino,
    That is interesting. FWIW I am no longer using Knoppix for a hard disk installation, but I have moved on to a Kanotix derivative called Paipix.
    See
    http://aamorimsrv.fis.fc.ul.pt/tikiw...page=PaiPix_EN

    This gives a working combination of PHP5, MySQL, PostgreSQL, Apache2, and Zope.

    Regards,
    Mark

Similar Threads

  1. VERY ODD mysql error
    By morbidpalooza.com in forum Networking
    Replies: 2
    Last Post: 07-08-2006, 01:30 PM
  2. MySQL
    By mzee in forum Knoppix DVD
    Replies: 17
    Last Post: 10-12-2005, 08:48 AM
  3. MySQL Error
    By sniker in forum Hdd Install / Debian / Apt
    Replies: 2
    Last Post: 10-08-2004, 03:50 AM
  4. mysql Error no more ptys Hung ptys Too many connections
    By paradocs in forum General Support
    Replies: 0
    Last Post: 08-18-2003, 10:13 PM
  5. [MySQL] Export a DB From PHPMyAdmin to /var/lib/mysql
    By Coume in forum General Support
    Replies: 5
    Last Post: 08-06-2003, 06:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Vintage Apple II Avant-Garde Creations  Super Shape Draw And Animate 1981 picture

Vintage Apple II Avant-Garde Creations Super Shape Draw And Animate 1981

$295.00



Vintage Apple Design Keyboard Model M2980 Macintosh 1994 Untested picture

Vintage Apple Design Keyboard Model M2980 Macintosh 1994 Untested

$28.49



Vintage Apple Macintosh Plus 1MB - M0001A W/ Keyboard, 2 Mice, 800K HD, + More picture

Vintage Apple Macintosh Plus 1MB - M0001A W/ Keyboard, 2 Mice, 800K HD, + More

$300.00



Vintage Apple Macintosh LC M0350 Desktop No Harddrive No Power Supply - Parts picture

Vintage Apple Macintosh LC M0350 Desktop No Harddrive No Power Supply - Parts

$71.95



Vintage Apple Macintosh Plus Desktop Computer - M0001A picture

Vintage Apple Macintosh Plus Desktop Computer - M0001A

$150.00



Rare Vintage Macintosh Apple Wooden Disk Storage Box Dovetailed picture

Rare Vintage Macintosh Apple Wooden Disk Storage Box Dovetailed

$69.95



5x Vintage Apple Macintosh II NuBus Cards 630-4179 NI GPIB DIO Asante Ethernet picture

5x Vintage Apple Macintosh II NuBus Cards 630-4179 NI GPIB DIO Asante Ethernet

$239.95



Retro Vintage Apple M0110A Compact Wired Mechanical keyboard for Macintosh Plus picture

Retro Vintage Apple M0110A Compact Wired Mechanical keyboard for Macintosh Plus

$64.95



Vintage Apple Monitor IIc 9

Vintage Apple Monitor IIc 9" Green Monochrome 06/1985 A2M4090 October 1984 Stand

$275.00



Vintage Apple Multiple Scan 15av Display Monitor M4681 picture

Vintage Apple Multiple Scan 15av Display Monitor M4681

$299.99