PHP 编译完成后,能够经过一个简单的函数 phpinfo() 查看关于 PHP 的全部信息。如下介绍的模块一览,皆所有来自于函数 phpinfo() 的输出信息。 php
什么是 SAPI?
SAPI 即 Server API, Server Application Programming Interface。 html
用于 Apache 2 的模块,当安装的是 PHP 5 的时候,编译出来的文件名是 libphp5.so;当安装的是 PHP 7 的时候,编译出来的文件名是 libphp7.so。
libphp5.so 或 libphp7.so 一般被安装在 Apache 的安装目录下的 modules 目录。
编译的时候需指定参数 with-apxs2=FILE,好比 with-apxs2=/usr/local/apache/bin/apxs mysql
CGI,意为 Common Gateway Interface。
一般编译安装在 PHP 安装目录 bin 下,这个可执行文件名是 php-cgi。 web
CLI,意为 Command Line。命令行模式。
一般编译安装在 PHP 安装目录 bin 下,这个可执行文件名是 php。
输入 php -h 显示其用法。 sql
默认不编译安装,除非指定编译参数 enable-embed
该模块容许在 C/C++ 语言中调用 PHP 提供的函数。 shell
FastCGI Process Manager,也就是 FPM,PHP FastCGI 进程的管理器。 数据库
用于 LiteSpeed 的模块,默认不编译。
经过指定编译参数 with-litespeed 安装。 Build PHP as litespeed module apache
从 PHP 5.6 开始,引入了 phpdbg,交互式调试器,用于 Debug PHP 程序,能够在不用修改代码,不影响性能的状况下控制 PHP 的运行环境。
一般编译安装在 PHP 安装目录 bin 下,这个可执行文件名是 phpdbg。
PHP 5.4 和 5.5 也能够单独安装该模块。 json
PHP 源码自带的扩展模块,根据 PHP 版本的不一样略有差异,大体为如下这么 71 个模块。 session
经过指定编译参数 enable-bcmath 安装。 Enable bc style precision math functions
经过指定编译参数 with-bz2=DIR 安装。 Include BZip2 support
Debian/Ubuntu 需安装 libbz2-dev 依赖包。
Redhat/CentOS 需安装 bzip2-devel 依赖包。
经过指定编译参数 enable-calendar 安装。 Enable support for calendar conversion
Windows 专用扩展。COM 是指 Component Object Model,组件对象模型,是多项微软技术与框架的基础,包括OLE、OLE自动化、ActiveX、COM+、DCOM、Windows shell、DirectX、Windows Runtime。
此扩展默认为启用,编译时可经过下列选项禁用:disable-ctype
经过指定编译参数 with-curl=DIR 安装。 Include cURL support
Debian/Ubuntu 需安装 libcurl4-gnutls-dev 依赖包。
Redhat/CentOS 需安装 curl-devel 依赖包。
日期和时间函数,默认编译安装,不可禁止。
经过指定编译参数 enable-dba 安装。 Build DBA with bundled modules
该参数会默认自带 3 个参数,with-cdb,enable-inifile,inifile-flatfile,若要禁止,则需经过参数without-cdb=DIR,disable-inifile,disable-flatfile 实现。
Windows 专用扩展。用于链接 SQL Server 和 Sybase 数据库的 PDO 驱动扩展。
此扩展默认为启用,Document Object Model。编译时可经过下列选项禁用:disable-dom
经过指定编译参数 with-enchant=DIR 安装。 Include enchant support. GNU Aspell version 1.1.3 or higher required.
通常需指定其目录,with-enchant=/usr
Debian/Ubuntu 需安装 libenchant-dev, libpspell-dev 依赖包。
Redhat/CentOS 需安装 enchant-devel, aspell-devel 依赖包。
经过指定编译参数 enable-exif 安装。 Enable EXIF (metadata from p_w_picpaths) support
此扩展默认为启用,fileinfo support。编译时可经过下列选项禁用:disable-fileinfo
注意:在内存比较小的机器上编译此扩展时可能会失败,所以内存加 SWAP 的容量小于 480MB 时就不要安装了。
此扩展默认为启用,input filter support。编译时可经过下列选项禁用:disable-filter
另若是要给此扩展指定 PCRE 安装目录的话,则还有如下的编译参数。
with-pcre-dir FILTER: pcre install prefix
with-interbase=DIR Include Firebird support. DIR is the Firebird base install directory
with-pdo-firebird=DIR PDO: Firebird support. DIR is the Firebird base install directory
经过指定编译参数 enable-ftp 安装。Enable FTP support
安装该扩展还有个参数 with-openssl-dir=DIR FTP: openssl install prefix,可不指定,则使用系统自带 openssl 库。
经过指定编译参数 with-gd=DIR 安装。Include GD support. DIR is the GD library base install directory BUNDLED
这是一个打包式的依赖,须要依赖以下安装包。
with-webp-dir=DIR(PHP 7.0, 7.1 only)
with-jpeg-dir=DIR
with-png-dir=DIR
with-zlib-dir=DIR
with-xpm-dir=DIR
with-freetype-dir=DIR
enable-gd-native-ttf
enable-gd-jis-conv
PHP5.四、PHP5.五、PHP5.6 则还有个
with-vpx-dir=DIR
Debian/Ubuntu 需安装 libwebp-dev, libjpeg-dev, libpng-dev, libxpm-dev, libfreetype6-dev, libvpx-dev 依赖包。
Redhat/CentOS 需安装 libwebp-devel, libjpeg-devel, libpng-devel, libXpm-devel, freetype-devel, libvpx-devel 依赖包。
经过指定编译参数 with-gettext=DIR 安装。Include GNU gettext support
Debian/Ubuntu 需安装 gettext 依赖包。
Redhat/CentOS 需安装 gettext, gettext-devel 依赖包。
经过指定编译参数 with-gmp=DIR 安装。Include GNU MP support
Debian/Ubuntu 需安装 libgmp-dev 依赖包。
Redhat/CentOS 需安装 gmp-devel 依赖包。
此扩展默认为启用,编译时可经过下列选项禁用:disable-hash Disable hash support
此扩展默认为启用,编译时可经过下列选项禁用:without-iconv=DIR Exclude iconv support
经过指定如下编译参数。
with-imap=DIR Include IMAP support. DIR is the c-client install prefix
with-kerberos=DIR IMAP: Include Kerberos support. DIR is the Kerberos install prefix
with-imap-ssl=DIR IMAP: Include SSL support. DIR is the OpenSSL install prefix
编译此选项时,PHP 需指定 libc-client.a 所在目录。
with-interbase=DIR Include Firebird support. DIR is the Firebird base install directory
经过指定编译参数 enable-intl 安装。 Enable internationalization support
此扩展默认为启用,编译时可经过下列选项禁用:disable-json Disable JavaScript Object Serialization support
with-ldap=DIR Include LDAP support
with-ldap-sasl=DIR LDAP: Include Cyrus SASL support
Debian/Ubuntu 需安装 libldap-2.4-2, libldap2-dev 依赖包。
Redhat/CentOS 需安装 openldap, openldap-devel 依赖包。
此扩展默认为启用,编译时可经过下列选项禁用:disable-libxml Disable LIBXML support
with-libxml-dir=DIR LIBXML: libxml2 install prefix
Debian/Ubuntu 需安装 libxml2, libxml2-dev 依赖包。
Redhat/CentOS 需安装 libxml2, libxml2-devel 依赖包。
经过指定编译参数 enable-mbstring 安装。 Enable multibyte string support
disable-mbregex MBSTRING: Disable multibyte regex support
disable-mbregex-backtrack MBSTRING: Disable multibyte regex backtrack check
with-libmbfl=DIR MBSTRING: Use external libmbfl. DIR is the libmbfl base install directory BUNDLED
with-onig=DIR MBSTRING: Use external oniguruma. DIR is the oniguruma install prefix. If DIR is not set, the bundled oniguruma will be used
libmbfl 对 mbstring 是必要的。libmbfl 被捆绑到了 mbstring。
Debian/Ubuntu 需安装 libonig2, libonig-dev 依赖包。
Redhat/CentOS 需安装 oniguruma, oniguruma-devel 依赖包。
经过指定编译参数 with-mcrypt=DIR 安装。 Include mcrypt support
Debian/Ubuntu 需安装 libmcrypt-dev 依赖包。
Redhat/CentOS 需编译安装 libmcrypt 和 mcrypt 。若是安装了 EPEL 的话,则需安装 libmcrypt-devel 依赖包。
with-mysql-sock=SOCKPATH MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer
指定系统里安装的 MYSQL 的 mysql.sock 路径。
with-pdo-mysql=DIR PDO: MySQL support. DIR is the MySQL base directory
指定系统里安装的 MYSQL 的基本目录。若未指定,则默认安装 mysqlnd(MySQL native driver)
with-mysqli=FILE Include MySQLi support. FILE is the path to mysql_config
指定系统里安装的 MYSQL 的目录下的 mysql_config 文件路径。
经过指定编译参数 enable-mysqlnd 安装。 Enable mysqlnd explicitly, will be done implicitly when required by other extensions
另若是要给此扩展指定 libz 目录的话,则还有如下的编译参数。
with-zlib-dir=DIR mysqlnd: Set the path to libz install prefix
with-oci8=DIR Include Oracle Database OCI8 support. DIR defaults to $ORACLE_HOME
系统里安装了 Oracle 数据库的话,则指定为 $ORACLE_HOME;不然需安装 Oracle Instant Client,指定为 /path/to/instant/client/lib
with-pdo-odbc=flavour,dir
PDO: Support for ‘flavour’ ODBC driver.
include and lib dirs are looked for under ‘dir’.
‘flavour’ can be one of: ibm-db2, iODBC, unixODBC, generic
If ‘,dir’ part is omitted, default for the flavour
you have selected will be used. e.g.:
with-pdo-odbc=unixODBC
will check for unixODBC under /usr/local. You may attempt to use an otherwise unsupported driver using the “generic” flavour.
The syntax for generic ODBC support is:
with-pdo-odbc=generic,dir,libname,ldflags,cflags
When built as ‘shared’ the extension filename is always pdo_odbc.so
ODBC 有不少种,通常使用以下编译参数便可。
with-unixODBC=DIR Include unixODBC support /usr/local
Debian/Ubuntu 需安装 unixodbc, unixodbc-dev 依赖包。
Redhat/CentOS 需安装 unixODBC, unixODBC-devel 依赖包。
注意:PHP 默认会去 /usr/local/include 下去找头文件 sqlext.h,因此还要作个软连接。
ln -s /usr/include/sqlext.h /usr/local/include/
with-openssl=DIR Include OpenSSL support (requires OpenSSL >= 1.0.1)
with-kerberos=DIR OPENSSL: Include Kerberos support
with-system-ciphers OPENSSL: Use system default cipher list instead of hardcoded value
PHP 7.1 所需的 openssl 版本是 >= 1.0.1
PHP 7.0 所需的 openssl 版本是 >= 0.9.8
PHP 5.6 所需的 openssl 版本是 >= 0.9.6
PHP 5.5 所需的 openssl 版本是 >= 0.9.6
PHP 5.4 所需的 openssl 版本是 >= 0.9.6
PHP 5.3 所需的 openssl 版本是 >= 0.9.6
with-pdo-oci=DIR PDO: Oracle OCI support. DIR defaults to $ORACLE_HOME.
Use with-pdo-oci=instantclient,prefix,version for an Oracle Instant Client SDK.
For example on Linux with 11.2 RPMs use:
with-pdo-oci=instantclient,/usr,11.2
经过指定编译参数 enable-pcntl 安装。 Enable pcntl support (CLI/CGI only)
with-pcre-regex=DIR Include Perl Compatible Regular Expressions support. DIR is the PCRE install prefix BUNDLED
with-pcre-jit Enable PCRE JIT functionality
此扩展默认为启用,编译时可经过下列选项禁用:disable-phar Disable phar support
此扩展默认为启用,编译时可经过下列选项禁用:disable-pdo Disable PHP Data Objects support
此扩展默认为启用,编译时可经过下列选项禁用:disable-posix Disable POSIX-like functions
with-pdo-pgsql=DIR PDO: PostgreSQL support. DIR is the PostgreSQL base install directory or the path to pg_config
with-pgsql=DIR Include PostgreSQL support. DIR is the PostgreSQL base install directory or the path to pg_config
with-pspell=DIR Include PSPELL support. GNU Aspell version 0.50.0 or higher required
通常需指定其目录,with-pspell=/usr
Debian/Ubuntu 需安装 libpspell-dev 依赖包。
Redhat/CentOS 需安装 aspell-devel 依赖包。
with-readline=DIR Include readline support (CLI/CGI only)
Debian/Ubuntu 需安装 libreadline-dev 依赖包。
Redhat/CentOS 需安装 readline-devel 依赖包。
with-recode=DIR nclude recode support
Debian/Ubuntu 需安装 librecode-dev 依赖包。
Redhat/CentOS 需安装 recode-devel 依赖包。
此扩展默认为启用。
此扩展默认为启用,编译时可经过下列选项禁用:disable-session Disable session support
另若是要给此扩展指定 mm 支持的话,则还有如下的编译参数。
with-mm=DIR SESSION: Include mm support for session storage
经过指定编译参数 enable-shmop 安装。 Enable shmop support
此扩展默认为启用,编译时可经过下列选项禁用:disable-simplexml Disable SimpleXML support
另若是要给此扩展指定 libxml2 目录的话,则还有如下的编译参数。
with-libxml-dir=DIR SimpleXML: libxml2 install prefix
经过指定编译参数 with-snmp=DIR 安装。 Include SNMP support
另若是要给此扩展指定 openssl 目录的话,则还有如下的编译参数。
with-openssl-dir=DIR SNMP: openssl install prefix
Debian/Ubuntu 需安装 libsnmp-dev 依赖包。
Redhat/CentOS 需安装 net-snmp-devel 依赖包。
经过指定编译参数 enable-soap 安装。 Enable SOAP support
另若是要给此扩展指定 libxml2 目录的话,则还有如下的编译参数。
with-libxml-dir=DIR SOAP: libxml2 install prefix
经过指定编译参数 enable-sockets 安装。 Enable sockets support
此扩展默认为启用。
此扩展默认为启用,编译时可经过下列选项禁用:without-sqlite3=DIR Do not include SQLite3 support. DIR is the prefix to SQLite3 installation directory
此扩展默认为启用,编译时可经过下列选项禁用:without-pdo-sqlite=DIR PDO: sqlite 3 support. DIR is the sqlite base install directory BUNDLED
经过指定编译参数 enable-sysvmsg 安装。 Enable sysvmsg support
经过指定编译参数 enable-sysvsem 安装。 Enable System V semaphore support
经过指定编译参数 enable-sysvshm 安装。 Enable the System V shared memory support
经过指定编译参数 with-tidy=DIR 安装。 Include TIDY support
通常需指定其目录,with-tidy=/usr
Debian/Ubuntu 需安装 libtidy-dev 依赖包。
Redhat/CentOS 需安装 libtidy-devel 依赖包。
此扩展默认为启用,编译时可经过下列选项禁用:disable-tokenizer Disable tokenizer support
经过指定编译参数 enable-wddx 安装。 Enable WDDX support
另若是要给此扩展指定 libxml2 目录的话,则还有如下的编译参数。
with-libxml-dir=DIR WDDX: libxml2 install prefix
此扩展默认为启用,编译时可经过下列选项禁用:disable-xmlreader Disable XMLReader support
另若是要给此扩展指定 libxml2 目录的话,则还有如下的编译参数。
with-libxml-dir=DIR XMLReader: libxml2 install prefix
经过指定编译参数 with-xmlrpc=DIR 安装。 Include XMLRPC-EPI support
另若是要给此扩展指定 libxml2 和 iconv 目录的话,则还有如下的编译参数。
with-libxml-dir=DIR XMLRPC-EPI: libxml2 install prefix
with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI
此扩展默认为启用,编译时可经过下列选项禁用:disable-xml Disable XML support
此扩展默认为启用,编译时可经过下列选项禁用:disable-xmlwriter Disable XMLWriter support
经过指定编译参数 with-xsl=DIR 安装。 Include XSL support. DIR is the libxslt base install directory (libxslt >= 1.1.0 required)
Debian/Ubuntu 需安装 libxslt1-dev 依赖包。
Redhat/CentOS 需安装 libxslt-devel 依赖包。
经过指定编译参数 enable-zip 安装。 Include Zip read/write support
另若是要给此扩展指定 libz, PCRE 和 libzip 目录的话,则还有如下的编译参数。
with-zlib-dir=DIR ZIP: Set the path to libz install prefix
with-pcre-dir=DIR ZIP: pcre install prefix
with-libzip=DIR ZIP: use libzip
经过指定编译参数 with-zlib=DIR 安装。 Include ZLIB support (requires zlib >= 1.0.9)
Debian/Ubuntu 需安装 zlib1g-dev 依赖包。
Redhat/CentOS 需安装 zlib-devel 依赖包。
PHP 5.5 以后的版本,此扩展默认为启用,编译时可经过下列选项禁用:disable-opcache Disable Zend OPcache support
注意:默认编译安装不表明默认启用,还需配置到 ini 文件里才行。
扩展:ZendGuardLoader, ionCube Loader, XCache, Imagemagick, GraphicsMagick, Memcached, Redis, Mongodb, Swoole
框架:Laravel, Symfony, Nette, Yii, Zend Framework, Silex, Slim, CakePHP, ThinkPHP
CMS:Wordpress, Drupal, Joomla, Typecho, Phpcms,
包管理工具:Composer
原文出处:https://teddysun.com/504.html
原文做者:秋水逸冰
感谢原文做者的技术分享!