Linux下独立添加PHP扩展模块mbstring
环境php5.2.13, 不支持mbstring扩展
假如php的源码包在/usr/local/src/php-5.2.13
php安装目录是/usr/local/php
# cd /usr/local/src/php-5.2.13/ext/mbstring/
# rpm -qa|egrep "autoconf|gcc" 这个是检测这些组件是否安装,没有安装请执行下面这句,否则会报错
# yum -y install autoconf gcc gcc-c++
# phpize
# ./configure --with-php-config=/usr/local/bin/php-config
# make
# make install
执行完毕后在php.ini里增加extension=mbstring.so
重启web服务器, 看一下phpinfo, 应该支持mbstring了!
1.安装crul
wget http://curl.haxx.se/download/curl-7.19.6.tar.gz
tar -zxvf curl-7.19.6.tar.gz
cd curl-7.19.6
./configure --prefix=/usr/local/curl
make
make install
2.编译生成扩展
进入php源程序目录中的ext目录中,这里存放着各个扩展模块的源代码,选择你需要的模块,比如curl模块:
cd curl
执行phpize生成编译文件,phpize在PHP安装目录的bin目录下
/usr/local/php5/bin/phpize
运行时,可能会报错:Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
environment variable is set correctly and then rerun this script.,需要安装autoconf:
yum install autoconf(RedHat或者CentOS)、apt-get install autoconf(Ubuntu Linux)
生成配置文件,并编译生成模块:
/usr/local/php5/bin/phpize
./configure --with-curl=/usr/local/curl --with-php-config=/usr/local/php5/bin/php-config
make
make install
生成的文件在(如:/usr/local/php5/extensions/no-debug-non-zts-20090626/)
这样,curl.so就被复制到PHP对应目录(如:/usr/local/php5/extensions/)
3.修改配置
在php.ini里,设置扩展目录:
extension_dir = "/usr/local/php5/extensions/"
并添加扩展模块引用:
extension = curl.so
4.检查并重启Apache
/usr/local/php5/bin/php -v
执行这个命令时,php会去检查配置文件是否正确,如果有配置错误,这里会报错,可以根据错误信息去排查

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor