Linode.com Forum Forum Index Linode.com Forum
Linode Community Forums
 


Error when connecting to MySql via php4

Click here to go to the original topic

 
       Linode.com Forum Forum Index -> Linux, Apache, Mysql and PHP (LAMP) Forum
Author Message
OrionXI



Joined: 29 Jun 2003
Posts: 18

Posted: Mon Sep 29, 2003 5:56 pm    Post subject: Error when connecting to MySql via php4  

I installed apache-ssl, php4 and mysql 3.23.49 using apt-get. They all work fine by themselves, and apache has no problem with the usual php functions, e.g. phpinfo(). But when I try to connect to mysql with a script using

mysql_connect("localhost", "root", "*******") or exit();

I get the error message:

Fatal error: Call to undefined function: mysql_connect() in /var/www/htdocs/index.php on line 36

Then I tried:

apt-get install php4-mysql

but I still get the same error message.

Any ideas?? Thanks.
Back to top  
rko



Joined: 20 Aug 2003
Posts: 38
Location: Hayward, CA

Posted: Mon Sep 29, 2003 10:12 pm    Post subject:  

When you run phpinfo(), what do you get for "Configure Command" values? Sounds like you have php version in apache that don't have mysql built in.

Risto
Back to top  
OrionXI



Joined: 29 Jun 2003
Posts: 18

Posted: Tue Sep 30, 2003 1:28 am    Post subject:  

Here's what I get from phpinfo():

'../configure' '--prefix=/usr' '--with-apxs=/usr/bin/apxs' '--with-regex=php' '--with-config-file-path=/etc/php4/apache' '--disable-rpath' '--disable-debug' '--enable-memory-limit' '--enable-calendar' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-bcmath' '--with-bz2' '--enable-ctype' '--with-db2' '--with-iconv' '--with-ndbm' '--enable-exif' '--enable-filepro' '--enable-ftp' '--with-gettext' '--enable-mbstring' '--with-pcre-regex=/usr' '--enable-shmop' '--enable-sockets' '--enable-wddx' '--with-xml=/usr' '--with-expat-dir=/usr' '--enable-yp' '--with-zlib' '--without-pgsql' '--disable-static' '--with-layout=GNU' '--with-curl=shared,/usr' '--with-dom=shared,/usr' '--with-zlib-dir=/usr' '--with-gd=shared,/usr' '--with-jpeg-dir=shared,/usr' '--with-xpm-dir=shared,/usr/X11R6' '--with-png-dir=shared,/usr' '--with-freetype-dir=shared,/usr' '--with-imap=shared,/usr' '--with-ldap=shared,/usr' '--with-mcal=shared,/usr' '--with-mhash=shared,/usr' '--with-mm' '--with-mysql=shared,/usr' '--with-unixODBC=shared,/usr' '--with-recode=shared,/usr' '--enable-xslt' '--with-xslt-sablot=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-sybase-ct=shared,/usr' '--with-ttf=shared,/usr' '--with-t1lib=shared,/usr'

You can see it has '--with-mysql=shared,/usr' in there. Dunno if that's sufficient....
Back to top  
komy



Joined: 13 Aug 2003
Posts: 27

Posted: Tue Sep 30, 2003 12:12 pm    Post subject:  

In your php.ini, have you load the mysql.so extension?

I compiled php manually and I have to load the extension manually in php.ini in order to get it work.

You should have a line like:

Code: extension=mysql.so

in your ini file. Be sure to point the extension_dir to the dir where your extensions are located.

Hope this help.

Kevin
Back to top  
OrionXI



Joined: 29 Jun 2003
Posts: 18

Posted: Tue Sep 30, 2003 12:32 pm    Post subject:  

I was sure that I had already put the

extension=mysql.so

line in php.ini. But when I just checked it, it wasn't there. I must have forgot to save it.....hmmm. It works fine now. Thanks.
Back to top  
 
       Linode.com Forum Forum Index -> Linux, Apache, Mysql and PHP (LAMP) Forum
Page 1 of 1