LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mysql Php Extension (https://www.linuxquestions.org/questions/linux-newbie-8/mysql-php-extension-191081/)

SilentK 06-08-2004 08:39 AM

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?

SilentK 06-08-2004 09:30 AM

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.

Philippe 06-08-2004 10:39 AM

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

SilentK 06-08-2004 12:18 PM

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.

Hangdog42 06-08-2004 05:45 PM

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).

SilentK 06-10-2004 07:34 AM

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?

Hangdog42 06-11-2004 07:48 AM

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.

SilentK 06-11-2004 07:51 AM

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

Hangdog42 06-11-2004 07:56 AM

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.

SilentK 06-11-2004 08:02 AM

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

Hangdog42 06-11-2004 08:37 AM

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.

SilentK 06-11-2004 08:47 AM

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.


All times are GMT -5. The time now is 04:55 PM.