常用的配置参数
1. --prefix=/usr/local/php
指定 php 安装目录
install architecture-independent files in prefix 默认/usr/local
2.--with-config-file-path=path
php.ini的存放位置
set the path in which to look for php.ini [prefix/lib]
--with-config-file-scan-dir=path
php.ini的扩展目录
set the path where to scan for configuration files
3.--with-apxs2=file
生成libphp5.so ,httpd处理php的模块,需要用到apache的apxs支持 (需安装了httpd-devel)
build shared apache 2.0 handler module. file is the optional
pathname to the apache apxs tool apxs
4.--with-mysql=dir
加入mysql支持, mysql官方的mysql驱动目录,如果没设置dir就使用php自带的mysql驱动mysqlnd
include mysql support. dir is the mysql base directory, if no dir is passed or the value is
mysqlnd the mysql native driver will be used
5.--with-mysqli=file
加入mysqli支持,没有设置默认是mysqlnd
include mysqli support. file is the path to mysql_config. if no value or mysqlnd is passed
as file, the mysql native driver will be used
6.--with-pdo-mysql=dir
加入pdo支持,默认为自带驱动mysqlnd
pdo: mysql support. dir is the mysql base directory if no value or mysqlnd is passed as dir, the
mysql native driver will be used
7.--with-mysql-sock=sockpath
指定mysql套接字文件位置,如果没指定则搜索默认位置
mysql/mysqli/pdo_mysql: location of the mysql unix socket pointer.
if unspecified, the default locations are searched
8.--enable-sockets
开启sockets支持
enable sockets support
9.--with-libxml-dir=dir
libxml2 安装位置
simplexml: libxml2 install prefix
10.--enable-mbstring
使php支持对多字节字符串的处理
enable multibyte string support
11.--with-gd=dir
include gd support. dir is the gd library base install directory bundled
12.--with-curl=dir
加入curl支持
include curl support
13.--with-mcrypt=dir include mcrypt support
14.--enable-zip include zip read/write support
15.--enable-calendar
支持日历转换
enable support for calendar conversion
16.--with-zlib=dir
打开zlib库支持
include zlib support (requires zlib >= 1.0.9)
17.--enable-bcmath
打开图片大小调整,用到zabbix监控的时候用到了这个模块
enable bc style precision math functions
18. --enable-soap enable soap support
19.--with-iconv-dir=dir xmlrpc-epi: iconv dir for xmlrpc-epi
20.--with-freetype-dir=dir
打开对freetype字体库的支持
gd: set the path to freetype 2 install prefix
21.--with-jpeg-dir=dir
打开对jpeg图片的支持
gd: set the path to libjpeg install prefix
22.--with-png-dir=dir
打开对png图片的支持
gd: set the path to libpng install prefix
23.--without-sqlite3=dir
自php5.3起默认启用sqlite3 扩展,可以在编译时使用--without-sqlite3禁用sqlite3 扩展
do not include sqlite3 support. dir is the prefix to sqlite3 installation directory.
24.--enable-exif
开启图片的元数据支持
enable exif (metadata from images) support
25.--enable-ftp enable ftp support
26.--with-pcre-dir
filter: pcre install prefix
27.--disable-fileinfo
fileinfo在5.3以后就被默认安装的,小内存vps上编译php会out of memory
disable fileinfo support
28.--enable-shared=pkgs build shared libraries default=yes
生成动态链接库
--enable-static=pkgs build static libraries default=yes
生成静态链接库
29.--disable-ipv6 disable ipv6 support
30.--enable-phpdbg
轻量级、强大、易用的php调试平台,可以在php5.4和之上版本中使用,在php5.6和之上版本内部集成
build phpdbg
31.--enable-fpm enable building of the fpm sapi executable
--with-fpm-user=user set the user for php-fpm to run as. (default: nobody)
--with-fpm-group=grp set the group for php-fpm to run as. for a system user, this
should usually be set to match the fpm username (default: nobody)
32.--enable-posix
开启posix扩展支持
33.--enable-pcntl
开启pcntl扩展
34.--with-pear=dir install pear in dir [prefix/lib/php]
--without-pear do not install pear
需要单独安装的扩展
gd库, mbstring, mhash和mcrypt
1.指定了--with-apxs2=/usr/local/apache/bin/apxs以后,就不要再激活--enable-fpm和--enable-fastcgi,apxs是以php module的模式加载php的.
2.mysql在编译了mysql开发library以后,可以不用指定mysql的路径.
3.php编译存在基础的依赖的关系,编译php首先需要安装xml扩展,因为php5核心默认打开了xml的支持,其他的基础库,相应需要
4.gd -> zlib, png, jpg, 如果需要支持其他,仍需要根据实际情况编译扩展库,ttf库需要freetype库的支持。
5.--enable-magic-quotes,是一个极其不推荐的参数,当然,如果你需要php为你做这些底下的工作,实际上他也没有很彻底的解决问题。
6.-with-openssl 需要openssl库
mysqli是mysql团队提供的mysql驱动,具有很多实用的功能和典型特征。不过他不是mysql于php平台最好的选择,pdo被证实,是一个简易、高并发性,而且易于创建和回收的标准接口。不过pdo也经历了5.3以前的内存溢出的问题,在5.3以后,在读取oracle的lob资源时,若不对内存进行限制,仍会内存溢出。
如果是生产环境,好像pear、shmop、ftp等,都不推荐使用,语言,都有很好很快速的选择,无需局限于使用php去实现。不熟悉的类库和不常用的库,也不推荐使用。
magic-quote、session.auto_start、php服务器信息、php报错信息等在编译完成后,应该第一时间关闭,避免暴露服务器信息。
php对应的web server模式,module、fastcgi、fpm只需要一种即可,服务器不是你的试验田。fastcgi可以选择nginx和lighttpd,其实nginx也是使用lighttpd的spwan-fcgi进行fcgi进程管理的。fpm是使用php自身去管理多进程,有点类似一个后端代理。无论什么模式,在发布产品服务器,都应该做进程和线程调优,做足够多的性能及压力方面的测试,找出最好的进程数组合。
选好一种php opcode cache的扩展,这个也是很重要的,linux 2.6核心下,fcgi下,xcache有较好的实践经验,其他的在并发数增加以后,性能衰减严重。
如果真的想体验宁可编译多几个php版本,也不要针对一个版本的php集合各种扩展,适应各种环境,这会让把你自己逼进窘境的。
.configure --help
`configure' configures this package to adapt to many kinds of systems.usage: ./configure [option]... [var=value]...to assign environment variables (e.g., cc, cflags...), specify them asvar=value. see below for descriptions of some of the useful variables.defaults for the options are specified in brackets.configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -v, --version display version information and exit -q, --quiet, --silent do not print `checking ...' messages --cache-file=file cache test results in file [disabled] -c, --config-cache alias for `--cache-file=config.cache' -n, --no-create do not create output files --srcdir=dir find the sources in dir [configure dir or `..']installation directories: --prefix=prefix install architecture-independent files in prefix [/usr/local] --exec-prefix=eprefix install architecture-dependent files in eprefix [prefix]by default, `make install' will install all the files in`/usr/local/bin', `/usr/local/lib' etc. you can specifyan installation prefix other than `/usr/local' using `--prefix',for instance `--prefix=$home'.for better control, use the options below.fine tuning of the installation directories: --bindir=dir user executables [eprefix/bin] --sbindir=dir system admin executables [eprefix/sbin] --libexecdir=dir program executables [eprefix/libexec] --sysconfdir=dir read-only single-machine data [prefix/etc] --sharedstatedir=dir modifiable architecture-independent data [prefix/com] --localstatedir=dir modifiable single-machine data [prefix/var] --libdir=dir object code libraries [eprefix/lib] --includedir=dir c header files [prefix/include] --oldincludedir=dir c header files for non-gcc [/usr/include] --datarootdir=dir read-only arch.-independent data root [prefix/share] --datadir=dir read-only architecture-independent data [datarootdir] --infodir=dir info documentation [datarootdir/info] --localedir=dir locale-dependent data [datarootdir/locale] --mandir=dir man documentation [datarootdir/man] --docdir=dir documentation root [datarootdir/doc/package] --htmldir=dir html documentation [docdir] --dvidir=dir dvi documentation [docdir] --pdfdir=dir pdf documentation [docdir] --psdir=dir ps documentation [docdir]system types: --build=build configure for building on build [guessed] --host=host cross-compile to build programs to run on host [build] --target=target configure for building compilers for target [host]optional features and packages: --disable-option-checking ignore unrecognized --enable/--with options --disable-feature do not include feature (same as --enable-feature=no) --enable-feature[=arg] include feature [arg=yes] --with-package[=arg] use package [arg=yes] --without-package do not use package (same as --with-package=no) --with-libdir=name look for libraries in .../name rather than .../lib --disable-rpath disable passing additional runtime library search paths --enable-re2c-cgoto enable -g flag to re2c to use computed goto gcc extensionsapi modules: --with-aolserver=dir specify path to the installed aolserver --with-apxs=file build shared apache 1.x module. file is the optional pathname to the apache apxs tool apxs --with-apache=dir build apache 1.x module. dir is the top-level apache build directory /usr/local/apache --enable-mod-charset apache: enable transfer tables for mod_charset (rus apache) --with-apxs2filter=file experimental: build shared apache 2.0 filter module. file is the optional pathname to the apache apxs tool apxs --with-apxs2=file build shared apache 2.0 handler module. file is the optional pathname to the apache apxs tool apxs --with-apache-hooks=file experimental: build shared apache 1.x module. file is the optional pathname to the apache apxs tool apxs --with-apache-hooks-static=dir experimental: build apache 1.x module. dir is the top-level apache build directory /usr/local/apache --enable-mod-charset apache (hooks): enable transfer tables for mod_charset (rus apache) --with-caudium=dir build php as a pike module for use with caudium. dir is the caudium server dir /usr/local/caudium/server --disable-cli disable building cli version of php (this forces --without-pear) --with-continuity=dir build php as continuity server module. dir is path to the installed continuity server root --enable-embed=type experimental: enable building of embedded sapi library type is either 'shared' or 'static'. type=shared --enable-fpm enable building of the fpm sapi executable --with-fpm-user=user set the user for php-fpm to run as. (default: nobody) --with-fpm-group=grp set the group for php-fpm to run as. for a system user, this should usually be set to match the fpm username (default: nobody) --with-fpm-systemd activate systemd integration --with-fpm-acl use posix access control lists --with-isapi=dir build php as an isapi module for use with zeus --with-litespeed build php as litespeed module --with-milter=dir build php as milter application --with-nsapi=dir build php as nsapi module for netscape/iplanet/sun webserver --enable-phpdbg build phpdbg --enable-phpdbg-debug build phpdbg in debug mode --with-phttpd=dir build php as phttpd module --with-pi3web=dir build php as pi3web module --with-roxen=dir build php as a pike module. dir is the base roxen directory, normally /usr/local/roxen/server --enable-roxen-zts roxen: build the roxen module using zend thread safety --with-thttpd=srcdir build php as thttpd module --with-tux=moduledir build php as a tux module (linux only) --with-webjames=srcdir build php as a webjames module (risc os only) --disable-cgi disable building cgi version of phpgeneral settings: --enable-gcov enable gcov code coverage (requires ltp) - for developers only!! --enable-debug compile with debugging symbols --with-layout=type set how installed files will be laid out. type can be either php or gnu [php] --with-config-file-path=path set the path in which to look for php.ini [prefix/lib] --with-config-file-scan-dir=path set the path where to scan for configuration files --enable-sigchild enable php's own sigchld handler --enable-libgcc enable explicitly linking against libgcc --disable-short-tags disable the short-form = 0.9.6) --with-kerberos=dir openssl: include kerberos support --with-system-ciphers openssl: use system default cipher list instead of hardcoded value --with-pcre-regex=dir include perl compatible regular expressions support. dir is the pcre install prefix bundled --without-sqlite3=dir do not include sqlite3 support. dir is the prefix to sqlite3 installation directory. --with-zlib=dir include zlib support (requires zlib >= 1.0.9) --with-zlib-dir= define the location of zlib install directory --enable-bcmath enable bc style precision math functions --with-bz2=dir include bzip2 support --enable-calendar enable support for calendar conversion --disable-ctype disable ctype functions --with-curl=dir include curl support --enable-dba build dba with bundled modules. to build shared dba extension use --enable-dba=shared --with-qdbm=dir dba: qdbm support --with-gdbm=dir dba: gdbm support --with-ndbm=dir dba: ndbm support --with-db4=dir dba: oracle berkeley db 4.x or 5.x support --with-db3=dir dba: oracle berkeley db 3.x support --with-db2=dir dba: oracle berkeley db 2.x support --with-db1=dir dba: oracle berkeley db 1.x support/emulation --with-dbm=dir dba: dbm support --with-tcadb=dir dba: tokyo cabinet abstract db support --without-cdb=dir dba: cdb support (bundled) --disable-inifile dba: ini support (bundled) --disable-flatfile dba: flatfile support (bundled) --disable-dom disable dom support --with-libxml-dir=dir dom: libxml2 install prefix --with-enchant=dir include enchant support. gnu aspell version 1.1.3 or higher required. --enable-exif enable exif (metadata from images) support --disable-fileinfo disable fileinfo support --disable-filter disable input filter support --with-pcre-dir filter: pcre install prefix --enable-ftp enable ftp support --with-openssl-dir=dir ftp: openssl install prefix --with-gd=dir include gd support. dir is the gd library base install directory bundled --with-vpx-dir=dir gd: set the path to libvpx install prefix --with-jpeg-dir=dir gd: set the path to libjpeg install prefix --with-png-dir=dir gd: set the path to libpng install prefix --with-zlib-dir=dir gd: set the path to libz install prefix --with-xpm-dir=dir gd: set the path to libxpm install prefix --with-freetype-dir=dir gd: set the path to freetype 2 install prefix --with-t1lib=dir gd: include t1lib support. t1lib version >= 5.0.0 required --enable-gd-native-ttf gd: enable truetype string function --enable-gd-jis-conv gd: enable jis-mapped japanese font support --with-gettext=dir include gnu gettext support --with-gmp=dir include gnu mp support --with-mhash=dir include mhash support --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 --with-interbase=dir include interbase support. dir is the interbase base install directory /usr/interbase --enable-intl enable internationalization support --with-icu-dir=dir specify where icu libraries and headers can be found --disable-json disable javascript object serialization support --with-ldap=dir include ldap support --with-ldap-sasl=dir ldap: include cyrus sasl support --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 --with-mcrypt=dir include mcrypt support --with-mssql=dir include mssql-db support. dir is the freetds home directory /usr/local/freetds --with-mysql=dir include mysql support. dir is the mysql base directory, if no dir is passed or the value is mysqlnd the mysql native driver will be used --with-mysql-sock=sockpath mysql/mysqli/pdo_mysql: location of the mysql unix socket pointer. if unspecified, the default locations are searched --with-zlib-dir=dir mysql: set the path to libz install prefix --with-mysqli=file include mysqli support. file is the path to mysql_config. if no value or mysqlnd is passed as file, the mysql native driver will be used --enable-embedded-mysqli mysqli: enable embedded support note: does not work with mysql native driver! --with-oci8=dir include oracle database oci8 support. dir defaults to $oracle_home. use --with-oci8=instantclient,/path/to/instant/client/lib to use an oracle instant client installation --with-odbcver=hex force support for the passed odbc version. a hex number is expected, default 0x0300. use the special value of 0 to prevent an explicit odbcver to be defined. --with-adabas=dir include adabas d support /usr/local --with-sapdb=dir include sap db support /usr/local --with-solid=dir include solid support /usr/local/solid --with-ibm-db2=dir include ibm db2 support /home/db2inst1/sqllib --with-odbcrouter=dir include odbcrouter.com support /usr --with-empress=dir include empress support \$empresspath (empress version >= 8.60 required) --with-empress-bcs=dir include empress local access support \$empresspath (empress version >= 8.60 required) --with-birdstep=dir include birdstep support /usr/local/birdstep --with-custom-odbc=dir include user defined odbc support. dir is odbc install base directory /usr/local. make sure to define custom_odbc_libs and have some odbc.h in your include dirs. f.e. you should define following for sybase sql anywhere 5.5.00 on qnx, prior to running this configure script: cppflags=\-dodbc_qnx -dsqlany_bug\ ldflags=-lunix custom_odbc_libs=\-ldblib -lodbc\ --with-iodbc=dir include iodbc support /usr/local --with-esoob=dir include easysoft oob support /usr/local/easysoft/oob/client --with-unixodbc=dir include unixodbc support /usr/local --with-dbmaker=dir include dbmaker support --enable-opcache enable zend opcache support --enable-pcntl enable pcntl support (cli/cgi only) --disable-pdo disable php data objects support --with-pdo-dblib=dir pdo: dblib-db support. dir is the freetds home directory --with-pdo-firebird=dir pdo: firebird support. dir is the firebird base install directory /opt/firebird --with-pdo-mysql=dir pdo: mysql support. dir is the mysql base directory if no value or mysqlnd is passed as dir, the mysql native driver will be used --with-zlib-dir=dir pdo_mysql: set the path to libz install prefix --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 with 10.2 rpms use: --with-pdo-oci=instantclient,/usr,10.2.0.4 --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 --with-pdo-pgsql=dir pdo: postgresql support. dir is the postgresql base install directory or the path to pg_config --without-pdo-sqlite=dir pdo: sqlite 3 support. dir is the sqlite base install directory bundled --with-pgsql=dir include postgresql support. dir is the postgresql base install directory or the path to pg_config --disable-phar disable phar support --disable-posix disable posix-like functions --with-pspell=dir include pspell support. gnu aspell version 0.50.0 or higher required --with-libedit=dir include libedit readline replacement (cli/cgi only) --with-readline=dir include readline support (cli/cgi only) --with-recode=dir include recode support --disable-session disable session support --with-mm=dir session: include mm support for session storage --enable-shmop enable shmop support --disable-simplexml disable simplexml support --with-libxml-dir=dir simplexml: libxml2 install prefix --with-snmp=dir include snmp support --with-openssl-dir=dir snmp: openssl install prefix --enable-soap enable soap support --with-libxml-dir=dir soap: libxml2 install prefix --enable-sockets enable sockets support --with-sybase-ct=dir include sybase-ct support. dir is the sybase home directory /home/sybase --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 --disable-tokenizer disable tokenizer support --enable-wddx enable wddx support --with-libxml-dir=dir wddx: libxml2 install prefix --with-libexpat-dir=dir wddx: libexpat dir for xmlrpc-epi (deprecated) --disable-xml disable xml support --with-libxml-dir=dir xml: libxml2 install prefix --with-libexpat-dir=dir xml: libexpat install prefix (deprecated) --disable-xmlreader disable xmlreader support --with-libxml-dir=dir xmlreader: libxml2 install prefix --with-xmlrpc=dir include xmlrpc-epi support --with-libxml-dir=dir xmlrpc-epi: libxml2 install prefix --with-libexpat-dir=dir xmlrpc-epi: libexpat dir for xmlrpc-epi (deprecated) --with-iconv-dir=dir xmlrpc-epi: iconv dir for xmlrpc-epi --disable-xmlwriter disable xmlwriter support --with-libxml-dir=dir xmlwriter: libxml2 install prefix --with-xsl=dir include xsl support. dir is the libxslt base install directory (libxslt >= 1.1.0 required) --enable-zip include zip read/write support --with-zlib-dir=dir zip: set the path to libz install prefix --with-pcre-dir zip: pcre install prefix --with-libzip=dir zip: use libzip --enable-mysqlnd enable mysqlnd explicitly, will be done implicitly when required by other extensions --disable-mysqlnd-compression-support disable support for the mysql compressed protocol in mysqlnd --with-zlib-dir=dir mysqlnd: set the path to libz install prefixpear: --with-pear=dir install pear in dir [prefix/lib/php] --without-pear do not install pearzend: --with-zend-vm=type set virtual machine dispatch method. type is one of call, switch or goto type=call --enable-maintainer-zts enable thread safety - for code maintainers only!! --disable-inline-optimization if building zend_execute.lo fails, try this switch --enable-zend-signals use zend signal handlingtsrm: --with-tsrm-pth=pth-config use gnu pth --with-tsrm-st use sgi's state threads --with-tsrm-pthreads use posix threads (default)libtool: --enable-shared=pkgs build shared libraries default=yes --enable-static=pkgs build static libraries default=yes --enable-fast-install=pkgs optimize for fast installation default=yes --with-gnu-ld assume the c compiler uses gnu ld default=no --disable-libtool-lock avoid locking (might break parallel builds) --with-pic try to use only pic/non-pic objects default=use both --with-tags=tags include additional configurations automaticsome influential environment variables: cc c compiler command cflags c compiler flags ldflags linker flags, e.g. -l if you have libraries in a nonstandard directory libs libraries to pass to the linker, e.g. -l cppflags (objective) c/c++ preprocessor flags, e.g. -i if you have headers in a nonstandard directory cpp c preprocessor yacc the `yet another c compiler' implementation to use. defaults to the first program found out of: `bison -y', `byacc', `yacc'. yflags the list of arguments that will be passed by default to $yacc. this script will default yflags to the empty string to avoid a default value of `-d' given by some make applications. cxx c++ compiler command cxxflags c++ compiler flags cxxcpp c++ preprocessoruse these variables to override the choices made by `configure' or to helpit to find libraries and programs with nonstandard names/locations.report bugs to the package provider.