Linux下php安装mysql扩展

第一步:进入php源码中的"ext/mysql"目录下
第二步:在当前目录下运行phpize

命令:/usr/local/php/bin/phpize 

成功结果如下:
[root@localhost mysql]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525

第三步:运行刚才生成的configure文件
命令:./configure --with-php-config=/usr/local/php/bin/php-config --with-mysql=/usr

此时会出现如下错误:
configure: error: Cannot find MySQL header files under /usr

解决类似问题使用如下命令:
命令:./configure --with-php-config=/usr/local/php/bin/php-config --with-mysql=/usr --with-libdir=lib64

成功后最后几行显示如下信息:
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h

第四步:编译执行
命令:make && make install
成功后显示如下信息:

第五步:在php.ini中添加mysql扩展
在php.ini文件的最后添加一行:
extension = mysql.so
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值