douchuxun4162 2013-01-19 09:16
浏览 41

从linux上的源代码安装mysql,然后如何让它与php一起工作?

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 ?

UPDATE

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

  • 写回答

1条回答 默认 最新

  • dtpwra8456 2013-01-19 09:33
    关注

    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
    
    评论

报告相同问题?

悬赏问题

  • ¥20 关于#qt#的问题:Qt代码的移植问题
  • ¥50 求图像处理的matlab方案
  • ¥50 winform中使用edge的Kiosk模式
  • ¥15 关于#python#的问题:功能监听网页
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化