1. 文章
  2. 文章详情

PHP 扩展库的添加

PHP扩展库安装

1、安装时指定要加载的扩展库

    ./configure -prefix=/application/servers/php-server/php/ --with-curl --with-gd --with-openssl --enable-soap --with-libxml-dir --with-jpeg-dir --with-apxs2=/application/servers/php-server/apache2/bin/apxs --with-png-dir --with-zlib-dir  --with-mysql --with-mbstring --enable-mbstring=all

    上述命令,指定了php的安装路径,同时扩展curl、gd、openssl、soap、libxml等等库

2、php已安装完成后再安装扩展

    首先切换到扩展文件夹下,看是否有待扩展的库文件

    以追加扩展mbstring为例子,主要是解决编码问题,以保证php能支持何种编码:

    打开/application/servers/php-server/php/lib/php.ini文件,在extensions处追加extension=mbstring.so,其他扩展库依次类推

    重启apache服务器

3、PECL 扩展库安装

    PECL 是通过PEAR 打包系统来的 PHP 扩展库仓库

    pecl install extname 命令会自动下载扩展代码

发表评论

登录后才能评论

评论列表(0条)