1. 查看php支持编译哪些模块
[root@localhost ~]# cd php-5.6.28/ext/
[root@localhost ext]# ls
bcmath curl ereg filter hash json mssql odbc pdo pdo_odbc posix session soap sybase_ct tokenizer xmlwriter
bz2 date exif ftp iconv ldap mysql opcache pdo_dblib pdo_pgsql pspell shmop sockets sysvmsg wddx xsl
calendar dba ext_skel gd imap libxml mysqli openssl pdo_firebird pdo_sqlite readline simplexml spl sysvsem xml zip
com_dotnet dom ext_skel_win32.php gettext interbase mbstring mysqlnd pcntl pdo_mysql pgsql recode skeleton sqlite3 sysvshm xmlreader zlib
ctype enchant fileinfo gmp intl mcrypt oci8 pcre pdo_oci phar reflection snmp standard tidy xmlrpc
2. 假设编译mbstring模块
进入mbstring的源码包目录,利用phpize生成configure文件
[root@localhost ext]# cd mbstring/
[root@localhost mbstring]# /usr/local/php/bin/php
php php-cgi php-config phpize
[root@localhost mbstring]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[root@localhost mbstring]# ls
acinclude.m4 build config.m4 configure.in install-sh Makefile.global mbstring.c missing php_mbregex.c php_unicode.c README.libmbfl tests
aclocal.m4 config.guess config.sub config.w32 libmbfl mb_gpc.c mbstring.dsp mkinstalldirs php_mbregex.h php_unicode.h README_PHP3-i18n-ja ucgendat
autom4te.cache config.h.in configure CREDITS ltmain.sh mb_gpc.h mbstring.h oniguruma php_onig_compat.h README run-tests.php unicode_data.h
[root@localhost mbstring]# ./configure --with-php-config=/usr/local/php/bin/php-config
[root@localhost mbstring]# make && make install
编译完成后生成的文件存放在:
[root@localhost mbstring]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
curl.so mbstring.so opcache.so zip.so
3. 修改php.ini文件extension支持mbstring.so
extension=mbstring.so
网友评论