LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 01-27-2007, 06:54 PM   #1
alar
Member
 
Registered: Sep 2003
Location: Canada
Distribution: CentOS 5.5, Ubuntu 10.04, Linux Mint 11 gnome 64 bit
Posts: 336

Rep: Reputation: 36
is there a client install for MySql so PHP can connect to MySQL Server?


I have MySQL on another machine (same network). When I try to connect with PHP there is a
Code:
Call to undefined function mysql_connect()
No php isn't built with mySQL in phpinfo()

I tried GRANT access on the MySQL box to a user on the primary box.
I tried looking for a source version of php5-mysql - but I'm not sure that is what I want...

I'm using FC4 on both machines.
PHP 5.0.4 (here) and MySQL 5.027-standard (there).

Doesn't make sense to try and re-build PHP 'til unless I know how to point it to MySQL.

Do I have to install another complete version of MySQL so I can rebuild PHP?

Can somebody help me point my thoughts in the right direction on what is required for this connection?

Thanks!
 
Old 01-27-2007, 07:39 PM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
What distro? Did you install using RPM? I believe most RPM based packages have a PHP-MySQL package for the connection functionality and compatibility for MySQL databases.
 
Old 01-27-2007, 08:12 PM   #3
alar
Member
 
Registered: Sep 2003
Location: Canada
Distribution: CentOS 5.5, Ubuntu 10.04, Linux Mint 11 gnome 64 bit
Posts: 336

Original Poster
Rep: Reputation: 36
Both distro's are FC4.

No. I don't use RPM's. I did see a bit where you could just install
a php5-mysql package if you used packages.

Maybe I could just install a new PHP and then the php5-mysql package?

My current PHP is compiled for Oracle (on the same box as MySQL is installed).
Code:
./configure' \
  --with-oci8-instant-client=/home/oinstall/instantclient_10_2' \
  --prefix=/usr/local/php' \
  --with-apxs=/usr/local/apache1.3.31/sbin/apxs' \
  --enable-sigchild' \
  --with-config-file-path=/usr/local/apache1.3.31/etc' \
I think I'm stuck in an Oracle head-space ;-)
But that's how I got to wondering, how to rebuild PHP if there isn't a local MySQL install?

This should be basic. Shouldn't it?
BTW: Maybe I should add, it's been a few years since I used MySQL.
I have an old application that I'm trying to revive for connection testing.

the db_connect.inc
Code:
<?php
$dbhost = 'mach4.mynet.com';
$dbuser = 'mysql';
$dbpass = 'password';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die  
                    ('Error connecting to mysql');

$dbname = 'test';
mysql_select_db($dbname); 
?>

Last edited by alar; 01-27-2007 at 08:26 PM.
 
Old 01-27-2007, 10:46 PM   #4
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
You need to compile PHP with MySQL support then.. usually looks like this in your configure command:

-with-mysql=/usr/local/mysql
 
Old 01-27-2007, 10:47 PM   #5
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
You can always test by creating a php info page to see what's enabled, etc:

<HTML><\n>
<HEAD><TITLE>PHP Test</TITLE></HEAD>
<BODY>
<?phpinfo() ?>
</BODY>
</HTML>
 
Old 01-27-2007, 10:59 PM   #6
alar
Member
 
Registered: Sep 2003
Location: Canada
Distribution: CentOS 5.5, Ubuntu 10.04, Linux Mint 11 gnome 64 bit
Posts: 336

Original Poster
Rep: Reputation: 36
Quote:
You need to compile PHP with MySQL support then.. usually looks like this in your configure command:

-with-mysql=/usr/local/mysql
This is the dilemma, I don't have a /usr/local/mysql on this machine.
Well, I guess I do
Quote:
[root@bilbo php-5.1.1]# which mysql
/usr/bin/mysql
Came with the distro? I guess?

But:
Code:
[root@bilbo php-5.1.1]# mysql -v
mysql: error while loading shared libraries: libmysqlclient.so.14: cannot open shared object file: No such file or directory
[root@bilbo php-5.1.1]# mysql -version
mysql: error while loading shared libraries: libmysqlclient.so.14: cannot open shared object file: No such file or directory
I'm sorry. I really don't know much about mysql....

Bottom line, guess I have to install mysql locally then?
 
Old 01-28-2007, 03:37 AM   #7
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Missing the libmysqlclient.so.14 usually means you just need to download and install the mysql-compat package for that version to use mysql as a client to another remote machine.
 
Old 01-28-2007, 03:57 AM   #8
wildar
Member
 
Registered: Jan 2007
Distribution: Mandriva 2008, Mandrake 2005, Ubuntu 8.04.1
Posts: 239

Rep: Reputation: 30
If it was installed via RPM, libmysqlclient.so.14 should have gone to /usr/lib. But if you installed by another means, perhaps its there but in a different directory. If there is a libmysqlclient.so.14, try doing a symbolic link from /usr/bin to where ever it currently resides.
 
Old 07-03-2007, 08:42 PM   #9
elfgirl
LQ Newbie
 
Registered: Jul 2007
Posts: 1

Rep: Reputation: 0
Question Anyone found an answer for this yet?

Hi -

Just wondering if anyone had figured out a fix for this yet. I'm having the exact same issue, except that my server doesn't have mysql installed on it locally anymore. The local mysql program was recently removed since we have a new standalone mysql server, and I now can't upgrade PHP.

Before mysql was taken off, my working ./configure options were:
cd /opt/app/app_src/php-5.1.6
./configure --with-openssl-dir=/opt/app/openssl --enable-sigchild --prefix=/opt/app/php --with-mime-magic --without-pic --enable-memory-limit --enable-force-cgi-redirect --with-apxs2=/opt/app/apache/bin/apxs --with-mysql --with-mysqli




Any help appreciated.

Thanks,
-R

Last edited by elfgirl; 07-03-2007 at 08:46 PM.
 
  


Reply

Tags
mysql, php, remote


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 03:13 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 08:19 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 02:52 AM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) sunlinux Linux - Software 1 11-07-2006 01:08 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM


All times are GMT -5. The time now is 10:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration