Linux下php安装mysql扩展
第一步:进入php源码中的"ext/mysql"目录下第二步:在当前目录下运行phpize命令:/usr/local/php/bin/phpize 成功结果如下:[root@localhost mysql]# /usr/local/php/bin/phpizeConfiguring for:PHP Api Version: 201
·
第一步:进入php源码中的"ext/mysql"目录下
第二步:在当前目录下运行phpize
命令:/usr/local/php/bin/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
更多推荐
已为社区贡献1条内容
所有评论(0)