This article mainly introduces the description of common PHP compilation parameters in Chinese. This article describes the function of PHP compilation parameters in Chinese. For more information, see
Compilation of common PHP parameters
The code is as follows:
-- Prefix =/usr/local/php # specify the php installation directory
-- With-apxs2 =/usr/local/apache/bin/apxs # integrated apache, apxs function is to use the LoadModule command in mod_so, load the specified module to apache, require apache to open the SO Module
-- With-config-file-path =/usr/local/php/etc # specifies the php3.ini or php4.ini path.
-- With-MySQL =/usr/local/mysql # mysql installation directory, which supports mysql
-- With-mysqli =/usr/local/mysql/bin/mysql_config # The mysqli extension technology can not only call MySQL stored procedures, but also process MySQL transactions, it also makes database access more stable.
-- With-mysql-sock =/tmp/mysql. sock # specify the location of the mysql socket file
-- Enable-safe-mode # enable security mode. the default value is enable.
-- Disable-short-tags # after this option is configured, PHP programs cannot use short tags, which must be long tags.
-- With-exec-dir = DIR # PHP execution path (sometimes it specifies the directory in which the PHP program must be executed for system security considerations)
-- Enable-ftp # enable ftp support
-- Enable-zip # enable zip support
-- With-bz2 # open support for bz2 files
-- With-jpeg-dir # enable support for jpeg images
-- With-png-dir # open support for png images
-- With-freetype-dir # open support for freetype library
-- Without-iconv # Disable The iconv function to convert various character sets.
-- With-libXML-dir # Open libxml2 library support
-- With-XMLrpc # Open the C language of xml-rpc
-- With-zlib-dir # support for opening the zlib library
-- With-gd # support for opening the gd Library
-- Enable-gd-native-ttf # support TrueType string function library
-- With-curl # Support for enabling the curl browser tool
-- With-curlwrappers # Use the curl tool to open the url Stream
-- With-ttf # enable freetype1. *. you can skip this step.
-- With-xsl # Open the support for XSLT files. libXML2 library is extended and libxslt software is required.
-- With-gettext # Open The gnu gettext support, which is used by the encoding library.
-- With-pear # support for opening the pear command, which is used for PHP extension
-- Enable-calendar # enable the calendar extension function
-- Enable-mbstring # multi-byte, string supported
-- Enable-sqlite-utf8 # make sqllite support UTF-8
-- Enable-bcmath # enable image size adjustment. this module is used for zabbix monitoring.
-- Enable-sockets # enable sockets
-- Enable-exif # metadata support for images
-- Enable-magic-quotes # magic reference support
-- Disable-rpath # disable additional runtime library files
-- Disable-debug # disable debugging mode
-- Enable-debug # this option is generally not used unless it is useful when developing a PHP program. It can display additional error messages
-- With-ldap = DIR # to use the Directory Protocol (Lightweight Directory Access Protocol, LDAP), you must enable this option. For more information about LDAP, see RFC1777 and RFC1778 in the RFC file.
-- With-mime-magic =/usr/share/file/magic. mime # magic header file location
-- With-apache = DIR # with this option, PHP can be used as an apache Module. the DIR string can be/usr/local/apache or other directories that install apache.
-- With-custom-odbc = DIR # use the custom ODBC function library. Of course, you must specify the CUSTOM_ODBC_LIBS and CFLAGS variables when using this method. For example, when using Sybase SQL Anywhere on the QNX machine, you may need to configure the system environment variables CFLAGS =-DODBC_QNX, LDFLAGS =-lunix and CUSTOM_ODBC_LIBS = "-ldblib-lodbc ", add -- with-custom-odbc =/usr/lib/sqlany50 to the PHP configuration.
-- With-oracle = DIR # Use the Oracle database. The Oracle version must be later than version 7.3. You can also use the environment variable ORACLE_HOME in the PHP program to specify the path of Oracle. For more information about Oracle, see Oracle's website http://www.oracle.com
-- With-sybase = DIR # Use the Sybase database. For more information about Sybase, see Sybase's website http://www.sybase.com
-- With-sybase-ct = DIR # use Sybase-CT database
Common parameters for CGI installation:
The code is as follows:
-- Enable-fpm # this parameter is available only after the PHP-fpm patch is installed. the startup program installed in CGI mode
-- Enable-fastCGI # supports fastcgi to start PHP
-- Enable-force-CGI-redirect # start PHP in redirection mode
-- With-ncurses # A dynamic library that supports ncurses screen rendering and graphic interaction based on text terminals
-- Enable-pcntl # freeTDS needs to be used, which may be used only when mssql is linked.
-- With-mcrypt # mcrypt algorithm extension
-- With-mhash # mhash algorithm extension
The above function library needs to be installed
-- With-gmp # should support a specification
-- Enable-inline-optimization # optimized thread
-- With-openssl # openssl support, used for encrypted transmission
-- Enable-dbase # Create a DBA as a shared module
-- With-pcre-dir =/usr/local/bin/pcre-config # installation location of perl regular expression library
-- Disable-dmalloc
-- With-gdbm # gdbm support for dba
-- Enable-sigchild
-- Enable-sysvsem
-- Enable-sysvshm
-- Enable-zend-multibyte # supports multiple zend bytes.
-- Enable-mbregex
-- Enable-wddx
-- Enable-shmop
-- Enable-soap
Note: extensions to be separately installed
1. gd Library.
2. ming extension.
3. mhash and mcrypt extensions
1> after -- with-apxs2 =/usr/local/apache/bin/apxs is specified, do not activate -- enable-fpm and -- enable-fastCGI, apxs loads php in the PHP module mode.
2> After Mysql compiles the Mysql development library, you do not need to specify the mysql path.
3> PHP compilation has a basic dependency. to compile PHP, you must first install XML extension. because the php5 core enables XML support by default, and other basic libraries need:
4> GD-> zlib, Png, and Jpg. if you need to support others, you still need to compile the extension library based on the actual situation. The ttf Library needs freetype library support.
5> -- enable-magic-quotes is an extremely unrecommended parameter. of course, if you need PHP to do the underlying work for you, it does not solve the problem thoroughly.
6>-with-openssl: the openssl library is required.
Mysqli is a MySQL driver provided by the MySQL team. it has many practical functions and typical features. However, he is not the best choice for MySQL on the PHP platform. PDO has been proven to be a simple, highly concurrent standard interface that is easy to create and recycle. However, PDO also experienced memory overflow problems before 5.3. After 5.3, when reading Oracle LOB resources, if the memory is not limited, the memory will still overflow.
It is not recommended for product models such as pear, shmop, and ftp. what they want to do is use C/C ++, Java, or other scripting languages, there are good and fast options, and there is no need to limit to using PHP for implementation. Unfamiliar class libraries and infrequently used libraries are not recommended. Magic-quote, session. auto_start, PHP server information, and PHP error information should be closed immediately after compilation to avoid exposing server information.
For the Web Server mode corresponding to PHP, Module, fastcgi, and fpm only need one type. the Server is not your test field. Fastcgi can select Nginx and lighttpd. In fact, Nginx uses lighttpd's spwan-fcgi for fcgi process management. Fpm uses PHP to manage multiple processes, which is similar to a backend proxy. Regardless of the mode, process and thread optimization should be performed on the launch product server to test the performance and pressure to find the best combination of process numbers.
It is also important to choose a PHP OPCode cache extension. at the core of linux 2.6 and fcgi, xcache has good practical experience. when the number of concurrent threads increases, severe performance attenuation. If you really want to try it out, you 'd rather compile several more PHP versions than compile various extensions for one version of PHP to adapt to various environments, which will put yourself in a dilemma.