Results 1 to 4 of 4

Thread: php & mysql mysql_connect() error

Hybrid View

  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
  •  


Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot picture

Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot

$285.90



128GB USB 14-in-1 MacOS bootable Installer repair recovery tech support service picture

128GB USB 14-in-1 MacOS bootable Installer repair recovery tech support service

$39.99



Microsoft Windows 11 Pro 64bit - New Sealed – Flash USB 1 PC picture

Microsoft Windows 11 Pro 64bit - New Sealed – Flash USB 1 PC

$49.99



Zero Trace Pen: All-in-one Tor Network Anonymous Drive + Cryptocurrency Wallet picture

Zero Trace Pen: All-in-one Tor Network Anonymous Drive + Cryptocurrency Wallet

$147.00



USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack picture

USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack

$826.09



USB Type-A Flash Drive Metal Memory Stick High Speed USB Drive 128GB 256GB 512GB picture

USB Type-A Flash Drive Metal Memory Stick High Speed USB Drive 128GB 256GB 512GB

$8.47



Lot 5/10pcs USB Flash Drive Memory Stick 1MB-64GB Pendrive Thumb Drive 8GB 32GB picture

Lot 5/10pcs USB Flash Drive Memory Stick 1MB-64GB Pendrive Thumb Drive 8GB 32GB

$282.00



1/ 10/ 100pcs USB 2.0 2GB, 4GB ,8GB ,16GB ,32GB ,64GB 128GB USB Flash Drives Lot picture

1/ 10/ 100pcs USB 2.0 2GB, 4GB ,8GB ,16GB ,32GB ,64GB 128GB USB Flash Drives Lot

$269.10



Windows 11 Pro Install/Recovery/Repair USB Flash Drive picture

Windows 11 Pro Install/Recovery/Repair USB Flash Drive

$35.00



FLASHFORGE 3D Printer AD5X Multi-Color IFS Auto Refill High Speed Printing US picture

FLASHFORGE 3D Printer AD5X Multi-Color IFS Auto Refill High Speed Printing US

$349.00