PHP Common Compilation Parameters Description in Chinese

  • 2021-07-21 07:38:44
  • OfStack

Explanation of Common Parameters in Compiling PHP


--prefix=/usr/local/php #指定 php 安装目录
--with-apxs2=/usr/local/apache/bin/apxs #整合apache,apxs功能是使用mod_so中的LoadModule指令,加载指定模块到 apache,要求 apache 要打开SO模块
--with-config-file-path=/usr/local/php/etc #用来指定 php3.ini 或 php4.ini 的路径
--with-MySQL=/usr/local/mysql #mysql安装目录,对mysql的支持
--with-mysqli=/usr/local/mysql/bin/mysql_config #mysqli扩展技术不仅可以调用MySQL的存储过程、处理MySQL事务,而且还可以使访问数据库工作变得更加稳定。
--with-mysql-sock=/tmp/mysql.sock #指定mysql套接字文件位置
--enable-safe-mode #打开安全模式,默认值是打开的
--disable-short-tags  #配置本选项后,PHP 的程序就不能使用短的标记,1定要用的长标记
--with-exec-dir=DIR  #PHP 执行路径(有时为了系统的安全性考虑,会指定 PHP 程序1定要在哪个目录执行)
--enable-ftp #打开ftp的支持
--enable-zip #打开对zip的支持
--with-bz2 #打开对bz2文件的支持
--with-jpeg-dir #打开对jpeg图片的支持
--with-png-dir #打开对png图片的支持
--with-freetype-dir #打开对freetype字体库的支持
--without-iconv #关闭iconv函数,各种字符集间的转换
--with-libXML-dir #打开libxml2库的支持
--with-XMLrpc #打开xml-rpc的c语言
--with-zlib-dir #打开zlib库的支持
--with-gd #打开gd库的支持
--enable-gd-native-ttf #支持TrueType字符串函数库
--with-curl #打开curl浏览工具的支持
--with-curlwrappers #运用curl工具打开url流
--with-ttf #打开freetype1.*的支持,可以不加了
--with-xsl #打开XSLT 文件支持,扩展了libXML2库 ,需要libxslt软件
--with-gettext #打开gnu 的gettext 支持,编码库用到
--with-pear #打开pear命令的支持,PHP扩展用的
--enable-calendar #打开日历扩展功能
--enable-mbstring #多字节,字符串的支持
--enable-sqlite-utf8  #使sqllite支持utf-8
--enable-bcmath #打开图片大小调整,用到zabbix监控的时候用到了这个模块
--enable-sockets #打开 sockets 支持
--enable-exif #图片的元数据支持
--enable-magic-quotes #魔术引用的支持
--disable-rpath #关闭额外的运行库文件
--disable-debug #关闭调试模式
--enable-debug  #本选项1般不会使用,除非在开发 PHP 程序时比较有用。它可以显示额外的错误信息
--with-ldap=DIR  #若要使用目录协议 (Lightweight Directory Access Protocol, LDAP) 则必须要打开本选项。有关 LDAP 的细节,可以参考 RFC 文件的 RFC1777 及 RFC1778
--with-mime-magic=/usr/share/file/magic.mime #魔术头文件位置
--with-apache=DIR   #用本选项可以让 PHP 以apache的模块方式使用,DIR 的字符串可以是 /usr/local/apache 或其它安装apache的目录
--with-custom-odbc=DIR   #使用自订的 ODBC 函数库。当然,在使用本方式时要指定 CUSTOM_ODBC_LIBS 及 CFLAGS 变量。例如在 QNX 机器上使用 Sybase SQL Anywhere 时可能要配置系统环境变量 CFLAGS=-DODBC_QNX、LDFLAGS=-lunix 及 CUSTOM_ODBC_LIBS="-ldblib -lodbc",并要在 PHP 配置加入 --with-custom-odbc=/usr/lib/sqlany50
--with-oracle=DIR    #使用 Oracle 数据库。Oracle 的版本要在 7.3 版以上。您也可以在 PHP 程序中使用环境变量 ORACLE_HOME 来指定 Oracle 的路径。更多有关 Oracle 的信息请参考 Oracle 的网站 http://www.oracle.com
--with-sybase=DIR   #使用 Sybase 数据库。更多有关 Sybase 的信息请参考 Sybase 的网站 http://www.sybase.com
--with-sybase-ct=DIR  #使用 Sybase-CT 数据库

Common parameters for CGI installation:


--enable-fpm # Hit PHP-fpm This parameter is only available after patching, CGI The startup program installed in the mode
--enable-fastCGI # Support fastcgi Mode startup PHP
--enable-force-CGI-redirect # Start in redirected mode PHP
--with-ncurses # Support ncurses Dynamic library of screen rendering and graphic interaction function based on text terminal
--enable-pcntl #freeTDS What needs to be used may be links mssql Just use it
--with-mcrypt #mcrypt Extension of algorithm
--with-mhash #mhash Extension of algorithm
The above function library needs to be installed
--with-gmp # It should be support 1 Species specification
--enable-inline-optimization # Optimize threads
--with-openssl #openssl Support, used in encrypted transmission
--enable-dbase # Establish DBA As a shared module
--with-pcre-dir=/usr/local/bin/pcre-config #perl Installation location of regular library case of
--disable-dmalloc
--with-gdbm #dba Adj. gdbm Support
--enable-sigchild
--enable-sysvsem
--enable-sysvshm
--enable-zend-multibyte # Support zend Multibyte of
--enable-mbregex
--enable-wddx
--enable-shmop
--enable-soap

Remarks: Extensions that need to be installed separately

1. gd library.
2. Extension of ming.
3. Extensions to mhash and mcrypt

1 > After -with-apxs2=/usr/local/apache/bin/apxs is specified, do not activate-enable-fpm and-enable-fastCGI, which loads PHP in the mode of php module.

2 > Mysql After compiling Mysql to develop library, you don't have to specify the path of mysql.

3 > PHP compilation has a basic dependency relationship. To compile PHP, you need to install XML extension first, because php5 core opens XML support by default. Other basic libraries need:

4 > GD - > zlib, Png, Jpg, if you need to support others, you still need to compile the extension library according to the actual situation, and ttf library needs the support of freetype library.

5 > --enable-magic-quotes is an extremely unrecommended parameter. Of course, if you need PHP to do the bottom work for you, it doesn't really solve the problem thoroughly.

6 > -with-openssl, openssl library required.

The mysqli is the MySQL driver provided by the MySQL team and has many practical functions and typical features. However, it is not the best choice for MySQL on PHP platform, and PDO has been proved to be a simple, highly concurrent, and easy to create and recycle standard interface. However, PDO also experienced the problem of memory overflow before 5.3. After 5.3, when reading LOB resources of Oracle, if the memory is not limited, the memory will still overflow.

If it is a product mode, such as pear, shmop, ftp, etc., it is not recommended to use it. What they want to do is to use C/C + +, Java, and even other scripting languages, which have good and fast choices, and need not be limited to using PHP. Unfamiliar class libraries and infrequent libraries are not recommended. magic-quote, session.auto_start, PHP server information, PHP error reporting information, etc. should be closed at the first time after compilation to avoid exposing server information.

PHP corresponds to Web Server mode, Module, fastcgi and fpm only need one mode, and the server is not your experimental field. fastcgi can choose Nginx and lighttpd. In fact, Nginx also uses spwan-fcgi of lighttpd to manage fcgi process. fpm uses PHP itself to manage multiple processes, somewhat like a back-end agent. Whatever the pattern, you should do process and thread tuning on the release server, and do enough performance and stress testing to find the best combination of processes.

It is also very important to choose one extension of PHP OPCode cache. Under linux 2.6 core, fcgi and xcache have good practical experience, while others have serious performance degradation after the concurrency number increases. If you really want to experience it, you would rather compile several more versions of PHP than collect various extensions for one version of PHP to adapt to various environments, which will push you into a dilemma.


Related articles: