1,096   Centos

CentOS linux下为已经编译好的php环境添加mysqli扩展

添加扩展的基本步骤:
1,进入php源代码目录:

# cd /tmp/php-5.2.14/

2、再进入要添加的mysqli扩展源码目录:

# cd ext/mysqli/

2、调用已经编译好的php里面的phpize:

# /usr/local/php/bin/phpize

3、然后configure:

# ./configure --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/local/mysql/bin/mysql_config

4、通过之后进行安装

# make
# make install

5、编译之后,自动把mysqli.so放到了默认的php扩展目录下,我的为

/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/

phpinfo可查看或者执行命令/usr/local/php/bin/php-config –extension-dir

6,再修改php.ini 找到extension_dir 默认路径为 extension_dir=”./” 我修改后才启动加载的
在下面添加extension = “mysqli.so” 保存即可

extension_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
extension = "mysqli.so"

7、重启apache:

# service httpd restart



Leave a Reply

Your email address will not be published. Required fields are marked *