-
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?
-
Senior Member
registered user
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
-
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.
-
Senior Member
registered user
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
-
By morbidpalooza.com in forum Networking
Replies: 2
Last Post: 07-08-2006, 01:30 PM
-
By mzee in forum Knoppix DVD
Replies: 17
Last Post: 10-12-2005, 08:48 AM
-
By sniker in forum Hdd Install / Debian / Apt
Replies: 2
Last Post: 10-08-2004, 03:50 AM
-
By paradocs in forum General Support
Replies: 0
Last Post: 08-18-2003, 10:13 PM
-
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
-
Forum Rules

Atari 800 Home Computer System 800 Untested
$95.00

Vintage Atari 410 Program Recorder CIB Open Box Appears Unused 400 800
$194.99

DEFECTIVE Atari 810 Vintage Computer Disk Drive powers on Unit Only Boo G3D
$55.24

ATARI 800 XL 8-Bit Computer w/ Power Supply
$169.00

Vintage Atari 400/800 NOS Computer Parts – Assorted Service & Replacement Parts
$50.00

Original Atari ST Boot Disk SH, CA026311-003 c. 1985 Made in Japan TESTED
$39.95

Fujinet 1.7.1 Atari 400 800 800XL 130XE 65XE XEGS Assembled, Tested, Working
$99.99

Atari Jumbo Jet Pilot Vintage Floppy Disk Software Lot w/ 2 Disks
$29.99

Vintage Atari 800 Computer + 1050 Disk Drive Manuals Games Software Cables Power
$349.00

Atari 1040ST Computer System SM124 Monitor Megafile 60 SLMC804 Bundle W/ Boxes
$849.00