Linux下为PHP添加扩展库

WBOY
Release: 2016-06-23 13:52:23
Original
959 people have browsed it

例子:添加mbstring扩展库

1. 进入PHP源码目录(没有源码的可以先用命令:# php -v 查看版本号,然后上PHP官网下载源码)

2. 进入PHPi源码下的FTP扩展库的目录:

# cd [Your PHP Source Folder]/ext/mbstring

3. 使用 phpize 命令生成配置文件:

# phpize

4. 执行configure:

# ./configure --with-php-config=/usr/local/php/bin/php-config  (后面的路径要对应上本机的php目录的php-config)

5. 没有报错的话,执行make:

# make

6. make成功后,生成的扩展库文件在当前目录的 modules 子目录下,如本例则是mbstring.so,将此文件copy到“/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/” 下(对应本机的PHP目录)

7. 修改/etc/php.ini,在[mbstring]下添加一行:extension=mbstring.so,保存

8. 重启apache或nginx服务器(如果有用到amh面板的话,还需要使用命令才能生效:# amh php stop [Your Host] 和 # amh php start [Your Host])

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template