LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 06-08-2004, 09:39 AM   #1
SilentK
LQ Newbie
 
Registered: May 2004
Distribution: Gentoo
Posts: 24

Rep: Reputation: 15
Mysql Php Extension


I am having some problems getting php and mysql to work together. I wan't to run phpmyadmin so I can access my mysql remotely from the web without having to install a application. However I am having some frustrating problems getting php to work with mysql. The main problem right now is that phpmyadmin can't find the mysql.so file so it can't connect to the DB. There is a old version of php installed on the server that I am working with and it doesn't seem to be configured for mysql (the older version is php 4.2.2) anyways the configuration file for it is nowhere to be found so I can't reconfigure or reinstall it. I also tried installing php 4.3.4 before I knew that php 4.2.2 was installed. How can I get the mysql.so file?
 
Old 06-08-2004, 10:30 AM   #2
SilentK
LQ Newbie
 
Registered: May 2004
Distribution: Gentoo
Posts: 24

Original Poster
Rep: Reputation: 15
I created phpinfo file to see what was going on and noticed that it says that mysql is a supported database and that the with-mysql option was used when php was configured. However where it lists the files in the extension directory there is no mysql.so file. I did a updatedb command that a locate mysql.so command and came up with nothing.


Here's the configure command that was used...........
'./configure' '--host=i386-redhat-linux' '--build=i386-redhat-linux' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3' '--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--with-apxs2=/usr/sbin/apxs'

Under where it says DBX and than supported Databases mysql is listed. When I do a php -m command it also says that mysql should be there.

Last edited by SilentK; 06-08-2004 at 02:07 PM.
 
Old 06-08-2004, 11:39 AM   #3
Philippe
Member
 
Registered: Sep 2003
Location: Chiangmai, Thailand
Posts: 53

Rep: Reputation: 15
Hi,

You did not say which Linux and which version you are using ... but did you install the php-mysql rpm (in case of redhat or similar...) ?

Hope this helps.

Philippe
 
Old 06-08-2004, 01:18 PM   #4
SilentK
LQ Newbie
 
Registered: May 2004
Distribution: Gentoo
Posts: 24

Original Poster
Rep: Reputation: 15
It's redhat 9. I installed mysql from source and I didn't install php so im not sure how it was installed im guessing source.
 
Old 06-08-2004, 06:45 PM   #5
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,791
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
There is a really nice how-to on getting Apache, MySQL and PHP to work together at the Snort documentation site. Just ignore the bits about Snort and Acid (although if you have MySQL and PHP working, Snort and Acid aren't that much extra work).
 
Old 06-10-2004, 08:34 AM   #6
SilentK
LQ Newbie
 
Registered: May 2004
Distribution: Gentoo
Posts: 24

Original Poster
Rep: Reputation: 15
Well all I really need is the mysql.so file. I can't find it anywhere on the server.

I noticed that php-mysql installs the mysql.so file but every package for it I find is a rpm and I keep getting failed dependencies errors when I try to install it through the rpm so does anyone know where I can get a tarball version of it?

Last edited by SilentK; 06-10-2004 at 09:39 AM.
 
Old 06-11-2004, 08:48 AM   #7
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,791
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
After doing a bit of googling around, it looks to me like PHP wasn't compiled correctly. If you read through the Snort document I pointed you towards, you'll see that PHP needs to be configured at compile time to point to the MySQL directory. The flag would look something like --with-mysql=/path/to/mysql.

Now from your phpinfo dump:



Quote:
--with-mysql=shared,/usr
It looks to me like PHP is looking in the /usr directory for MySQL. If that isn't where MySQL actually lives, that could explain why phpmyadmin isn't finding the right files.

If I were in your shoes I would compile PHP from scratch. The Snort document points to sites that should solve the dependency problems.

Last edited by Hangdog42; 06-11-2004 at 08:53 AM.
 
Old 06-11-2004, 08:51 AM   #8
SilentK
LQ Newbie
 
Registered: May 2004
Distribution: Gentoo
Posts: 24

Original Poster
Rep: Reputation: 15
The mysql directory isn't where I have the shared libraries at I installed those from RPM and im not exactly sure where they wen't
 
Old 06-11-2004, 08:56 AM   #9
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,791
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
It really sounds to me like you need to start from the beginning. Unless you've specifically set up PHP, MySQL and Apache to work together, they may not. My opinion is that there is no quick fix to your problem. If anyone else has a different opinion, I'd love to hear it.
 
Old 06-11-2004, 09:02 AM   #10
SilentK
LQ Newbie
 
Registered: May 2004
Distribution: Gentoo
Posts: 24

Original Poster
Rep: Reputation: 15
Well I had them working together but I am not the only person who works on the server and something was changed and after that it wasn't working anymore. Everything should be set to work together. I could reinstall mysql and php I suppose but I don't think anything is wrong with mysql...

I reconfigured mysql with ./configure --with-mysql=/usr/lib/mysql
I got these messages
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
configure: error: Cannot find MySQL header files under /usr/libmysql

./configure ---with-mysql=/usr/local/mysql
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no

./configure ---with-mysql=/usr/bin/
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
configure: error: Cannot find MySQL header files under /usr/bin

Now I am guessing that not finding the socket is a bad thing. My mysql.sock file is located in /tmp
The shared libraries for mysql are located in /usr/lib/ I compiled mysql at /usr/local/mysql and the client files are located in /usr/bin

Last edited by SilentK; 06-11-2004 at 09:19 AM.
 
Old 06-11-2004, 09:37 AM   #11
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,791
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
Hm. Are you the admin or is that someone else? I guess at this point I would try to pursue finding out what was changed to break the PHP-MySQL connection. That could determine the future course of action. Also, if someone else is the admin, you're probably going to need their permission to really mess with the guts. If you're really lucky, you could even make it their problem.......


You're probably right in that MySQL doesn't need to be re-installed, but I'm still guessing that PHP might be. It might be worth looking in your php.ini file and seeing if anything there jumps out as misconfigured, but from the googling I did it sounds like PHP may need to be re-compiled.
 
Old 06-11-2004, 09:47 AM   #12
SilentK
LQ Newbie
 
Registered: May 2004
Distribution: Gentoo
Posts: 24

Original Poster
Rep: Reputation: 15
I am not the admin on it. I am pretty sure the the break was due to this older version 4.2.2. I had a newer version running with apache and than all the sudden it started using this 4.2.2 version that was compiled a year ago and isn't configured to work with mysql or doesn't seem to be anyways. I would uninstall it but I haven't reached the admin yet to find out if he is using it. I can tell that wasn't mean't to be using apache though. The directory it's pointing to for the apxs file no longer has a apxs file there.

Last edited by SilentK; 06-11-2004 at 09:49 AM.
 
  


Reply


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
php extension for postgresql xrado Slackware 3 12-06-2005 10:31 AM
PHP Extension for session_id tunasashimi Linux - Software 11 10-04-2005 04:46 AM
php cannot load mysql extension no_names_left Linux - Software 4 03-02-2005 08:31 PM
PHP difference between --without-mysql and extension=mysql.so progressdll Linux - Software 0 10-14-2004 08:44 AM
PHP does not show mysql as an extension Linix Linux - Newbie 7 01-31-2004 10:13 AM


All times are GMT -5. The time now is 01:56 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