Reputation: 825
I installed apache and php from source and got them working together a month ago. Because I'm learning both of them this term.
Now I need mysql to do more works. And I installed mysql from source just now. However I don't know how to let it work with php.
I looked around and found some topics on setting up LAMP environment. Most of them install mysql first and use command options --with-mysql=/usr/local/mysql
and --with-mysqli=/usr/local/mysql/bin/mysql_config
when installing php. But in my case, I installed php first.
Is there any way to let php know that I have installed mysql? Or should I reinstall php ?
Finally I recompiled my php source with appending --with-mysql=/opt/mysql
, --with-mysqli=/opt/mysql/bin/mysql_config
and --with-pdo-mysql
three configure options to let my php support the modules of mysql. Steps taken as follows:
1> stop apache and mysql services
2> backup php.ini
3> remove php
4> reconfigure php source
./configure --prefix=/opt/php --with-apxs2=/opt/apache/bin/apxs --with-mysql=/opt/mysql --with-mysqli=/opt/mysql/bin/mysql_config --with-pdo-mysql --...and other options
5> make and then make install
6> copy php.ini back and uncomment the corresponding directs on mysql modules
Upvotes: 0
Views: 745
Reputation: 17000
Why are you installing packages from source?
Use yum
in CentOS and apt-get
in Ubuntu like:
yum install php
yum install mysql
To make PHP work with MYSQL you have to install php-mysql
extention like:
yum install php-mysql
Upvotes: 2