Re: Enabling MySQL for PHP on CentOS 5



matt staggered into the Black Sun and said:
On Mar 28, 8:30 am, Dances With Crows wrote:
matt staggered into the Black Sun and said:
downloaded the rpm for the latest mysql build (5.0) both the server
and the client. I installed both of those and the mysql server is
running correctly. However, I cannot get PHP to use mysql correctly.
Put together a tiny PHP page that does <? phpinfo(); ?> . Take a
look at the output from that tiny page and grep it for "mysql".
where it shows the 'configure command' the option is --without-mysql
but everywhere I look says it should be configured with mysql support
enabled but I guess centos didnt do that.

That's not a good thing what are the people at CentOS smoking too many
web applications need MySQL if they don't offer a PHP with MySQL you'll
need to build it yourself or go look on the repositories for something
someone else has built. (Run-on sentences are hard to read; please
don't write like that!)

My php.ini file also has a mysql section but I still thought I had to
load the extension into the file with something like
'extension=mysql.so' or something similar.

Not AFAICT. Then again, I built my PHP with USE="mysql", so it already
had that.

Basically, I want php to have mysql support but I would rather not
have to reconfigure everything that is already installed.
google://centos php mysql configuration ? Or have you already tried
that and been unable to eyeball-grep anything useful out?
I have been googling similar things to that but all that I can seem to
find are instructions to install each portion from scratch.

If you have the mysql-dev and apache-dev packages installed, the only
thing you need to do is compile PHP and include the --with-mysql option
to ./configure . Really, the best long-term solution is to use a distro
that doesn't do something this stupid. A PHP without MySQL support is
about as useful as a three-legged horse AFAICT.

thought about doing that but when I go to php.net and try and find
installers for linux they tell me they dont have them on their site
because all linux distributions now come with php support.

"Installers"? You want the source tarball. Like so:

(download php5-1.2.3.4.tar.bz2 from the main site)
tar xjf php5-1.2.3.4
cd php5-1.2.3.4
../configure --help
(read and understand the output; there are a lot of flags that you can
set, the main ones you want are --with-mysql and --prefix .)
../configure
(read the output, if it complains about missing libraries, get busy
installing development packages)
make
make install

....BTDT, though it was 8 years ago. There *should* be a better way,
since so many people need PHP with MySQL. Check all the repositories
for other PHP packages, and see if you can find one with MySQL support.

Maybe if I can just get a copy of a mysql.so file I can put it in the
extensions directory and have everything work?

I don't think so. "ldd `which php`" tells me that my php is linked
against libmysqlclient.so.15 , which resides in /usr/lib/ here. If you
can't find a prebuilt package, you'll have to build the thing yourself--
though I can't imagine that's the ideal/approved solution for everyone
who's using CentOS.

--
For every complex problem, there is a solution that is simple,
neat, and wrong.
My blog and resume: http://crow202.dyndns.org:8080/wordpress/
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
.



Relevant Pages

  • Re: php installation problems; now mysql connection problems
    ... If I install with mysql, Will i lose my existing databases.? ... Reinstall PHP *with* mysql support and you will be fine. ... >>Do you Yahoo!? ...
    (freebsd-questions)
  • Re: php installation problems; now mysql connection problems
    ... I tried to installed PHP with MySQL but I could not successfully install it. ... >>Do you Yahoo!? ...
    (freebsd-questions)
  • Re: php installation problems; now mysql connection problems
    ... When you chose "install php without mysql", what you really did is install ... PHP without mysql _support_. ... Reinstall PHP *with* mysql support and you will be fine. ...
    (freebsd-questions)
  • RE: [PHP] PHP Installation question
    ... Sort of figured out the MySQL problem, but now I get an error when I run ... Subject: [PHP] PHP Installation question ... I am trying to install vBulletin and keep getting this error: Fatal error: ... The only thing I can find on this is that zlib needs to be configured ...
    (php.general)
  • Re: jabberd error, help
    ... for mysql. ... # make -DWITH_MYSQL install clean ... #make -DWITH_MYSQL -DWITH_OPENSSL_PORT install ... These are the packages on my system (OS: ...
    (freebsd-questions)