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
  •  


RAM-HOL-SAM60CPU RAM USB-C Powered Dock for Samsung Tab Active5 - 3 - 2 picture

RAM-HOL-SAM60CPU RAM USB-C Powered Dock for Samsung Tab Active5 - 3 - 2

$81.99



Samsung 2.5

Samsung 2.5" 870 EVO SSD SATA III 250GB 500GB 1TB Internet Solid State Drive Lot

$100.00



Genuine Samsung K406S Black Toner Cartridge - New and Sealed Box picture

Genuine Samsung K406S Black Toner Cartridge - New and Sealed Box

$35.99



WiFi Only Samsung Galaxy Tab A9 Plus 11.0

WiFi Only Samsung Galaxy Tab A9 Plus 11.0" 128GB Black SM-X210

$139.99



Samsung PM961 512GB PCIe Gen 3x4 NVMe 2280 M.2 SSD MZVLW512HMJP-000D1 picture

Samsung PM961 512GB PCIe Gen 3x4 NVMe 2280 M.2 SSD MZVLW512HMJP-000D1

$60.00



RAM-GDS-SKIN-SAM54-NG-1 RAM Mounts IntelliSkin® Next Gen for Samsung Tab Active4 picture

RAM-GDS-SKIN-SAM54-NG-1 RAM Mounts IntelliSkin® Next Gen for Samsung Tab Active4

$93.99



RAM-HOL-SAM52CPU RAM USB-C Powered Dock Samsung Tab Active4 Pro & Tab Active Pro picture

RAM-HOL-SAM52CPU RAM USB-C Powered Dock Samsung Tab Active4 Pro & Tab Active Pro

$81.99



Cell Phone Smartphone Computer repair banner poster sign iphone Samsung  picture

Cell Phone Smartphone Computer repair banner poster sign iphone Samsung

$89.99



NEW Samsung NoteBook NT930QCG touch LCD Full Screen Assembly Blue picture

NEW Samsung NoteBook NT930QCG touch LCD Full Screen Assembly Blue

$225.77



SAMSUNG FIT PLUS 128GB USB 3.1 Flash Drive - fully working & authentic picture

SAMSUNG FIT PLUS 128GB USB 3.1 Flash Drive - fully working & authentic

$24.95