PHP安裝配置說明

一、軟件下載

PHP5.3.0:http://cn2.php.net/get/php-5.3.0.tar.gz/from/this/mirror

Pear:http://de.pear.php.net/get/PEAR-1.9.0.tar

Mm:ftp://ftp.ossp.org/pkg/lib/mm/mm-1.4.2.tar.gz

二、環境檢查

已安裝Apache2.2.13(/usr/local/apache/),mm-1.4.2(/usr/local/mm/)

rpm -qa|grep mcrypt

libmcrypt-devel-2.5.8-4.el5.centos
libmcrypt-2.5.8-4.el5.centos

rpm -qa|grep mysql-devel
mysql-devel-5.0.77-3.el5

rpm -qa|grep pcre
pcre-6.6-2.el5_1.7

注:具體環境視編譯參數而定,此處僅給出下面編譯參數需要的部分環境

三、編譯安裝

1、INSTALL說明

第一章:
php作用:網站和網絡應用程序(服務器端腳本)  命令行腳本   桌面GUI應用程序


第二章:在Unix系統上安裝

警告:不建議在apache2中使用線程MPM,可以使用prefork MPM代替或者使用apache1。
兼容性:php4.2.0與apache2.0的SAPI兼容,php4.2.3與apache2.0.39協同工作,不能與其他版本工作。php4.3.0及以上與apache2的大部分當前版本兼容。所有提到的php版本與apache1.3.X的版本兼容。
警告:不建議在apache2中使用線程MPM,可以使用prefork MPM代替或者使用apache1。
兼容性:php4.2.0與apache2.0的SAPI兼容,php4.2.3與apache2.0.39協同工作,不能與其他版本工作。php4.3.0及以上與apache2的大部分當前版本兼容。所有提到的php版本與apache1.3.X的版本兼容。
基本安裝步驟指令(apache2共享模塊版本)
1.  gzip -d httpd-2_0_NN.tar.gz
2.  tar xvf httpd-2_0_NN.tar
3.  gunzip php-NN.tar.gz
4.  tar -xvf php-NN.tar
5.  cd httpd-2_0_NN
6.  ./configure --enable-so#在/usr/local/apache2下安裝了apache,設置了模塊加載支持並且使用了默認的MPM prefork方式。可以使用/usr/local/apache2/bin/apachectl start|stop啓動或停止apache
7.  make
8.  make install
    Now you have Apache 2.0.NN available under /usr/local/apache2,
    configured with loadable module support and the standard MPM prefork.
    To test the installation use your normal procedure for starting
    the Apache server, e.g.:
    /usr/local/apache2/bin/apachectl start
    and stop the server to go on with the configuration for PHP:
    /usr/local/apache2/bin/apachectl stop.
9.  cd ../php-NN
10. Now, configure your PHP.  This is where you customize your PHP
    with various options, like which extensions will be enabled.  Do a
    ./configure --help for a list of available options.  In our example
    we'll do a simple configure with Apache 2 and MySQL support.  Your
    path to apxs may differ, in fact, the binary may even be named apxs2 on
    your system.
      ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql#PHP編譯配置:可以使用各種選項(./configure --help查看所有可用的選項),例如開啓哪些擴展。這裏僅僅開啓了簡單的apache和mysql支持。
11. make
12. make install#除非特別說明,make install將安裝PEAR,可用的php工具如phpize,PHP CLI等。
    If you decide to change your configure options after installation,
    you only need to repeat the last three steps. You only need to
    restart apache for the new module to take effect. A recompile of
    Apache is not needed.
    Note that unless told otherwise, 'make install' will also install PEAR,
    various PHP tools such as phpize, install the PHP CLI, and more.
13. Setup your php.ini
    cp php.ini-dist /usr/local/lib/php.ini#設置php.ini文件。如果單獨指定ini文件位置,用--with-config-file-path參數指定。
    You may edit your .ini file to set PHP options.  If you prefer having
    php.ini in another location, use --with-config-file-path=/some/path in
    step 10.     If you instead choose php.ini-recommended, be certain to read the list
    of changes within, as they affect how PHP behaves.
14. Edit your httpd.conf to load the PHP module.  The path on the right hand
    side of the LoadModule statement must point to the path of the PHP
    module on your system.  The make install from above may have already
    added this for you, but be sure to check.
編輯httpd.conf文件加載php模塊。make install 可能已經添加了,但是最好檢查一下。如果是安裝的是php4,則用LoadModule php4_module modules/libphp4.so;如果是php5,則用LoadModule php5_module modules/libphp5.so。
    For PHP 4:
      LoadModule php4_module modules/libphp4.so
    For PHP 5:
      LoadModule php5_module modules/libphp5.so
15. Tell Apache to parse certain extensions as PHP.  For example,
    let's have Apache parse the .php extension as PHP.  You could
    have any extension(s) parse as PHP by simply adding more, with
    each separated by a space.  We'll add .phtml to demonstrate.
告訴apache那些擴展名要php來解析,可以添加任何擴展名讓php來解析,多個擴展名用空格分開即可。常見的還有設置phps的擴展名來顯示突出php源,設置如下
      AddType application/x-httpd-php .php .phtml 
    It's also common to setup the .phps extension to show highlighted PHP
    source, this can be done with:
      AddType application/x-httpd-php-source .phps 
16. Use your normal procedure for starting the Apache server, e.g.:
使用常見的過程來啓動apache服務:
      /usr/local/apache2/bin/apachectl start
以上的步驟是apache2.0支持將apache作爲SAPI模塊。當然apache和php還有其他很多配置選項通過configure --help可以查看。如果要使用多線程的apache2,則要在編譯apache時通過使用--with-mpm=worker或--with-mpm=perchild覆蓋MPM-Module模塊爲worker或者perchild,但要知道這樣做的後果(不推薦這麼做)。
  

2、configure --help說明

配置幫助表:

--help 顯示幫助信息 display this help and exit
--version 顯示版本 display version information and exit
--quiet, --silent 不顯示checking……信息 do not print`checking...' messages
--cache-file=FILE
在指定文件中存儲測試結果
cache test results in FILE [disabled]
--no-create configure腳本運行結束後不輸出結果文件,常用於正式編譯前的測試。 do not create output files

安裝目錄:

--srcdir=DIR 源文件庫所在目錄 find the sources in DIR [configure dir or `..']
--prefix=PREFIX 體系無關文件的頂級安裝目錄PREFIX ,也就PHP的安裝目錄 install architecture-independent files in PREFIX
[/usr/local/apache2]
--exec-prefix=EPREFIX 體系相關文件的頂級安裝目錄EPREFIX ,把體系相關的文件安裝到不同的位置可以方便地在不同主機之間共享體系相關的文件 install architecture-dependent files in EPREFIX
[PREFIX]
--bindir=DIR 用戶可執行目錄DIR。用於存放PHP的支持程序 user executables [EPREFIX/bin]
--sbindir=DIR 系統管理員可執行目錄DIR ,用於存放運行PHP服務器所必須的服務程序 system admin executables [EPREFIX/sbin]
--libexecdir=DIR 程序可執行目錄DIR ,也就是動態加載模塊目錄 program executables [EPREFIX/libexec]
--sysconfdir=DIR 只讀的單一機器數據目錄DIR ,用於存放php.ini之類的服務器配置文件 read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR 可改寫的體系無關數據目錄DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR 可改寫的單一機器數據目錄DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR 對象代碼庫目錄DIR object code libraries [EPREFIX/lib]
--includedir=DIR PHP的C頭文件目錄DIR C header files [PREFIX/include]
--oldincludedir=DIR 非gcc的C頭文件目錄DIR C header files for non-gcc [/usr/include]
--datadir=DIR PHP服務器只讀的體系無關數據目錄DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR 信息文檔目錄DIR info documentation [DATAROOTDIR/info]
--localedir=DIR 地區相關數據DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR 手冊文檔目錄DIR man documentation [DATAROOTDIR/man]
--program-prefix=PREFIX
在安裝的程序名前面加上前綴
prepend PREFIX to installed program names
--program-suffix=SUFFIX
在安裝的程序名前面加上後綴
append SUFFIX to installed program names
--program-transform-name=PROGRAM 在運行的時候要運行sed程序腳本 run sed PROGRAM on installed program names

交叉編譯選項:

--build=BUILD 指定編譯工具所在系統的系統類型BUILD configure for building on BUILD [guessed]
--host=HOST 指定Apache HTTP服務器將要進行交叉編譯時運行的目標系統類型HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET 指定交叉編譯所產生的目標代碼類型 configure for building compilers for TARGET [HOST]

特徵選項:

--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) 禁用封裝
--x-includes=DIR X include files are in DIR 在目錄中包含X頭文件
--x-libraries=DIR X library files are in DIR 在目錄中包含X庫文件
--with-libdir=NAME Look for libraries in .../NAME rather than .../lib 庫文件查找路徑設置.../XXX/lib/
--disable-rpath Disable passing additional runtime library search paths 禁用傳遞其他運行庫搜索路徑

SAPI modules(SAPI模塊設置):

--with-aolserver=DIR Specify path to the installed AOLserver 指定AOLserver網站服務器的安裝路徑
--with-apxs[=FILE] Build shared Apache 1.x module. FILE is the optional pathname to the Apache apxs tool [apxs] 編譯出共享的apache 1.x版本的共享模塊所存放的路徑
--with-apache[=DIR] Build Apache 1.x module. DIR is the top-level Apache build directory [/usr/local/apache] 編譯Apache1.x版本的模塊,目錄是apache的軟件根目錄。
--enable-mod-charset APACHE: Enable transfer tables for mod_charset (Rus Apache) 爲apache的mod_charset模塊啓用傳輸表模式。(俄文的apache使用)
--with-apxs2filter[=FILE] EXPERIMENTAL: Build shared Apache 2.0 Filter module. FILE is the optional pathname to the Apache apxs tool [apxs] 實驗性:編譯apache2.0的共享過濾模塊。參數是apache apxs工具的路徑文件
--with-apxs2[=FILE] Build shared Apache 2.0 Handler module. FILE is the optional pathname to the Apache apxs tool [apxs] 編譯共享的apache2.0處理程序的模塊。參數是apache apxs工具的路徑文件
--with-apache-hooks[=FILE] EXPERIMENTAL: Build shared Apache 1.x module. FILE is the optional pathname to the Apache apxs tool [apxs] 實驗性:編譯共享的apache1.0的hooks模塊。參數是apache apxs工具的路徑文件
--with-apache-hooks-static[=DIR] EXPERIMENTAL: Build Apache 1.x module. DIR is the top-level Apache build directory [/usr/local/apache] 實驗性:編譯apache1.0的hooks模塊。參數是apache apxs工具的路徑文件
--enable-mod-charset APACHE (hooks): Enable transfer tables for mod_charset (Rus Apache)apache(hooks) 爲apache的mod_charset模塊啓用傳輸表模式。
--with-caudium[=DIR]
Build PHP as a Pike module for use with Caudium. DIR is the Caudium server dir [/usr/local/caudium/server]
爲Caudium服務器編譯Pick模塊。參數爲Caudium軟件的目錄。
--disable-cli Disable building CLI version of PHP 編譯禁用CLI的PHP版本。這個參數需要--without-pear (this forces --without-pear)
--with-continuity=DIR Build PHP as Continuity Server module. DIR is path to the installed Continuity Server root 編譯php爲連續服務模塊。參數爲安裝Continuity Server的根目錄。
--enable-embed[=TYPE] EXPERIMENTAL: Enable building of embedded SAPI library TYPE is either 'shared' or 'static'. [TYPE=shared] 實驗性:建立內嵌的SAPI庫。參數爲shared、static。
--with-isapi[=DIR] Build PHP as an ISAPI module for use with Zeus 爲Zeus web服務器建立ISAPI模塊。
--with-milter[=DIR] Build PHP as Milter application 編譯PHP爲Milter應用程序
--with-nsapi=DIR Build PHP as NSAPI module for Netscape/iPlanet/Sun Webserver 爲Netscape/iPlanet/Sun Web服務器編譯PHP爲NSAPI模塊。
--with-phttpd=DIR Build PHP as phttpd module 編譯PHP爲phttpd模塊
--with-pi3web[=DIR] Build PHP as Pi3Web module 編譯PHP爲Pi3web模塊
--with-roxen=DIR Build PHP as a Pike module. DIR is the base Roxen directory, normally /usr/local/roxen/server 編譯PHP爲Pike模塊。參數爲ROXEN軟件的路徑。
--enable-roxen-zts ROXEN: Build the Roxen module using Zend Thread Safety 編譯Roxen的模塊,使用Zend線程安全模式。
--with-thttpd=SRCDIR Build PHP as thttpd module 編譯PHP爲thttpd模塊
--with-tux=MODULEDIR Build PHP as a TUX module (Linux only) 編譯PHP爲TUX模塊(僅適用於linux下)
--with-webjames=SRCDIR Build PHP as a WebJames module (RISC OS only) 編譯PHP爲WebJames模塊(僅適用於RISC系統)
--disable-cgi Disable building CGI version of PHP 編譯禁用CGI的PHP版本
--enable-fastcgi CGI: Enable FastCGI support in the CGI binary 在CGI二進制中啓用FastCGI。
--enable-force-cgi-redirect CGI: Enable security check for internal server redirects. Use this if you run the PHP CGI with Apache 啓用內附服務重定向的安全檢查。如果使用在Apache下運行PHP的CGI則使用此項。
--enable-discard-path
CGI: When this is enabled the PHP CGI binary can safely be placed outside of the web tree and people will not be able to circumvent .htaccess security
當此項啓用時PHP CGI二進制能夠安全的代替外網樹並且能夠防止人們繞過.htaccess的安全。
--disable-path-info-check CGI: If this is disabled, paths such as /info.php/test?a=b will fail to work 禁用url參數。如果此項啓用,則如/info.php/test?a=b將不工作。

General settings(普通參數設置):

--enable-gcov Enable GCOV code coverage (requires LTP) - FOR DEVELOPERS ONLY!! 請用GCOV代碼覆蓋率(僅用於開發人員使用)
--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] 顯示安裝文件的佈局。參數爲PHP或GNU
--with-config-file-path=PATH Set the path in which to look for php.ini [PREFIX/lib] php.ini文件位置
--with-config-file-scan-dir=PATH Set the path where to scan for configuration files 掃描配置文件的路徑
--enable-safe-mode Enable safe mode by default 啓用默認的安全模式
--with-exec-dir[=DIR] Only allow executables in DIR under safe-mode [/usr/local/php/bin] 在安全模式目錄下僅允許可執行文件
--enable-sigchild Enable PHP's own SIGCHLD handler 使用PHP自帶的SIGCHLD處理器
--enable-magic-quotes Enable magic quotes by default. 默認激活magic quotes。可讓程序在執行時自動加入反斜線的引入字符。
--enable-libgcc Enable explicitly linking against libgcc 啓用libgcc的精確鏈接
--disable-short-tags Disable the short-form <? start tag by default 默認禁用短形式的<?作爲php代碼的開始標記
--enable-dmalloc Enable dmalloc 啓用dmalloc(dmalloc是Linux C編程偵測記憶體溢出工具)
--disable-ipv6 Disable IPv6 support 禁用IPv6支持
--enable-fd-setsize Set size of descriptor sets 設置描述集的大小

Extensions(擴展參數):

--with-EXTENSION=[shared[,PATH]]語法設置(注:並非所有模塊都可編譯成共享方式)
    NOTE: Not all extensions can be build as 'shared'.

下面的例子顯示了把foobar編譯成共享方式,並指定安裝路徑爲/usr/local/foobar/

Example: --with-foobar=shared,/usr/local/foobar/

      o Builds the foobar extension as shared extension.
      o foobar package install prefix is /usr/local/foobar/

--with-EXTENSION=[shared[,PATH]]

--disable-all Disable all extensions which are enabled by default 關閉默認爲啓用的所有擴展功能
--disable-libxml Disable LIBXML support 禁用LIBXML支持
--with-libxml-dir[=DIR] LIBXML: libxml2 install prefix LIBXML安裝目錄
--with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6) 啓用openssl支持
--with-kerberos[=DIR] OPENSSL: Include Kerberos support 包含kerberos支持
--without-pcre-regex Do not include Perl Compatible Regular Expressions support.DIR is the PCRE install prefix [BUNDLED] 禁用pcre(perl兼容正則表達式)支持。
--with-zlib[=DIR] Include ZLIB support (requires zlib >= 1.0.9) 啓用zlib支持
--with-zlib-dir=<DIR> Define the location of zlib install directory 定義zlib安裝所在的目錄
--enable-bcmath Enable bc style precision math functions 啓用bcmatch(公元前風格精度數學)
--with-bz2[=DIR] Include BZip2 support 包含BZip2支持
--enable-calendar Enable support for calendar conversion 啓用日曆轉換支持
--disable-ctype Disable ctype functions 禁用ctype功能
--with-curl[=DIR] Include cURL support 啓用cURL支持
--with-curlwrappers Use cURL for url streams 使用cURL作爲網址流
--enable-dba Build DBA with bundled modules. To build shared DBA extension use --enable-dba=shared 構架捆綁模塊的DBA。要建立擴展的共享模塊使用--enable-dba=shared參數。
--with-qdbm[=DIR] DBA: QDBM support 啓用QDBM支持
--with-gdbm[=DIR] DBA: GDBM support 啓用GDBM支持
--with-ndbm[=DIR] DBA: NDBM support 啓用NDBM支持
--with-db4[=DIR] DBA: Berkeley DB4 support 啓用Berkeley DB4支持
--with-db3[=DIR] DBA: Berkeley DB3 support 啓用Berkeley DB3支持
--with-db2[=DIR] DBA: Berkeley DB2 support 啓用Berkeley DB2支持
--with-db1[=DIR] DBA: Berkeley DB1 support/emulation 啓用Berkeley DB1支持/仿真
--with-dbm[=DIR] DBA: DBM support 啓用DBM支持
--without-cdb[=DIR] DBA: CDB support (bundled) 啓用CDB支持(捆綁方式)
--disable-inifile DBA: INI support (bundled) 啓用INI支持(捆綁方式)
--disable-flatfile DBA: FlatFile support (bundled) 啓用QDBM支持(捆綁方式)
--enable-dbase Enable the bundled dbase library 啓用捆綁的dbase庫
--disable-dom Disable DOM support 禁用DOM支持
--with-libxml-dir[=DIR] DOM: libxml2 install prefix 啓用libxml2並指定其安裝目錄
--enable-exif Enable EXIF (metadata from images) support 啓用EXIF支持(從圖片中獲取元數據)
--with-fbsql[=DIR] Include FrontBase support. DIR is the FrontBase base directory 包含FrontBase支持
--with-fdftk[=DIR] Include FDF support 包含FDF支持
--disable-filter Disable input filter support 禁用輸入過濾支持
--with-pcre-dir FILTER: pcre install prefix pcre 支持及其安裝目錄
--enable-ftp Enable FTP support 啓用ftp支持
--with-openssl-dir[=DIR] FTP: openssl install prefix 指定openssl的安裝目錄
--with-gd[=DIR] Include GD support. DIR is the GD library base install directory [BUNDLED] 啓用GD支持並指定GD庫的安裝目錄
--with-jpeg-dir[=DIR] GD: Set the path to libjpeg install prefix 指定libjpeg的安裝目錄
--with-png-dir[=DIR] GD: Set the path to libpng install prefix 指定libpng的安裝目錄
--with-zlib-dir[=DIR] GD: Set the path to libz install prefix 指定libz的安裝目錄
--with-xpm-dir[=DIR] GD: Set the path to libXpm install prefix 指定libXpm的安裝目錄
--with-ttf[=DIR] GD: Include FreeType 1.x support 指定FreeType 1.x的安裝目錄
--with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix 指定FreeType2的安裝目錄
--with-t1lib[=DIR] GD: Include T1lib support. T1lib version >= 5.0.0 required 指定T1lib支持
--enable-gd-native-ttf GD: Enable TrueType string function 啓用TureType字符功能
--enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support 啓用JIS-mapped日語字體支持
--with-gettext[=DIR] Include GNU gettext support 包含GNU gettext支持
--with-gmp[=DIR] Include GNU MP support 啓用GNU MP支持
--disable-hash Disable hash support 禁用hash支持
--without-iconv[=DIR] Exclude iconv support 禁用iconv支持
--with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix 包含IMAP支持。指定c-client安裝目錄
--with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install prefix 啓用kerberos支持並指定其目錄
--with-imap-ssl[=DIR] IMAP: Include SSL support. DIR is the OpenSSL install prefix 啓用ssl支持並指定openssl目錄
--with-interbase[=DIR] Include InterBase support. DIR is the InterBase base install directory [/usr/interbase] 啓用interbase支持並指定其目錄
--disable-json Disable JavaScript Object Serialization support 禁用JavaScript對象順序話支持
--with-ldap[=DIR] Include LDAP support 包含LDAP支持
--with-ldap-sasl[=DIR] LDAP: Include Cyrus SASL support 包含Cyrus SASL支持
--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] 使用外部的libmbfl並制定其目錄
--with-mcrypt[=DIR] Include mcrypt support 包含mcrypt支持
--with-mhash[=DIR] Include mhash support 包含mhash支持
--with-mime-magic[=FILE] Include mime_magic support (DEPRECATED!!) 啓用mime_magic支持(不推薦使用!)
--with-ming[=DIR] Include MING support 包含MING支持
--with-msql[=DIR] Include mSQL support. DIR is the mSQL base install directory [/usr/local/Hughes] 包含mSQL支持
--with-mssql[=DIR] Include MSSQL-DB support. DIR is the FreeTDS home directory [/usr/local/freetds] 包含MSSQL-DB支持,並指定FreeTDS軟件目錄
--with-mysql[=DIR] Include MySQL support. DIR is the MySQL base directory 包含MySQL支持
--with-mysql-sock[=DIR] MySQL: Location of the MySQL unix socket pointer. If unspecified, the default locations are searched 定位mysql的unix 套接字指針。如果未指定,則按默認位置搜索。
--with-zlib-dir[=DIR] MySQL: Set the path to libz install prefix 設置zlib的安裝目錄。
--with-mysqli[=FILE] Include MySQLi support. FILE is the optional pathname to mysql_config [mysql_config] 包含MySQLi支持。參數爲mysql_config的位置。
--enable-embedded-mysqli MYSQLi: Enable embedded support 啓用embedded支持。
--with-ncurses[=DIR] Include ncurses support (CLI/CGI only) 包含ncurses支持。
--with-oci8[=DIR] Include Oracle (OCI8) support. DIR defaults to $ORACLE_HOME. Use --with-oci8=instantclient,/path/to/oic/lib for an Oracle Instant Client installation 包含Oracle支持。如果使用Oracle客戶端安裝則使用--with-oci8=instantclient,/path/to/oic/lib
--with-adabas[=DIR] Include Adabas D support [/usr/local] 包含Adabas D支持
--with-sapdb[=DIR] Include SAP DB support [/usr/local] 包含SAP DB支持
--with-solid[=DIR] Include Solid support [/usr/local/solid] 包含Solid支持
--with-ibm-db2[=DIR] Include IBM DB2 support [/home/db2inst1/sqllib] 包含IBM DB2支持
--with-ODBCRouter[=DIR] Include ODBCRouter.com support [/usr] 包含ODBCRouter支持。
--with-empress[=DIR] Include Empress support [$EMPRESSPATH] (Empress Version >= 8.60 required) 包含empress支持
--with-empress-bcs[=DIR] Include Empress Local Access support [$EMPRESSPATH] (Empress Version >= 8.60 required) 包含Empress本地訪問支持。
--with-birdstep[=DIR] Include Birdstep support [/usr/local/birdstep] 包含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"

包括用戶自定義的ODBC的支持。目錄是ODBC安裝的主目錄。確定定義了CUSTOM_ODBC_LIBS並且在include目錄下有odbc.h的頭文件你要在QNX上爲Sybase SQL Anywhere定義如下:運行此之前,配置腳本

CPPFLAGS="-DODBC_QNX -DSQLANY_BUG"
LDFLAGS=-lunix
CUSTOM_ODBC_LIBS="-ldblib -lodbc"

--with-iodbc[=DIR] Include iODBC support [/usr/local] 包含iODBC支持
--with-esoob[=DIR] Include Easysoft OOB support [/usr/local/easysoft/oob/client] 包含Easysoft OOB支持
--with-unixODBC[=DIR] Include unixODBC support [/usr/local] 包含unixODBC支持
--with-dbmaker[=DIR] Include DBMaker support 包含DBMaker支持
--enable-pcntl Enable pcntl support (CLI/CGI only) 啓用pcntl支持。
--disable-pdo Disable PHP Data Objects support 禁用PHP數據對象支持。
--with-pdo-dblib[=DIR] PDO: DBLIB-DB support. DIR is the FreeTDS home directory 啓用DBLIB-DB支持。目錄爲FreeTDS主目錄。
--with-pdo-firebird[=DIR] PDO: Firebird support. DIR is the Firebird base install directory [/opt/firebird] 啓用Firebird支持。
--with-pdo-mysql[=DIR] PDO: MySQL support. DIR is the MySQL base directory 啓用PDO:mysql支持。
--with-zlib-dir[=DIR] PDO_MySQL: Set the path to libz install prefix 設置PDO:MySQL的zlib支持
--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 Linux with 10.2.0.3 RPMs (for example) use: --with-pdo-oci=instantclient,/usr,10.2.0.3 設置PDO:Oracle OCI支持。爲Oracle安裝客戶端SDK使用--with-pdo-oci=instantclient,prefix,version參數
--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, unixODBC, generic If ',dir' part is omitted, default for the flavour you have selected will 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 build as shared the extension filename is always pdo_odbc.so
啓用“flavour”ODBC支持。在dir目錄的include和lib目錄下查找。“flavour”參數值可以是ibm-db2, unixODBC, generic。如果dir省略,則使用默認值。如果你試圖通過generic使用一個如若不支持的驅動程序。爲generic ODBC提供的語法格式如下:--with-pdo-odbc=generic,dir,libname,ldflags,cflags。作爲共享的編譯後的擴展文件的名一般爲pdo_odbc.so
--with-pdo-pgsql[=DIR] PDO: PostgreSQL support. DIR is the PostgreSQL baseinstall directory or the path to pg_config 啓用PDO:PostgreSQL支持。
--without-pdo-sqlite[=DIR] PDO: sqlite 3 support. DIR is the sqlite baseinstall directory [BUNDLED] 啓用SQLite 3支持。
--with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQLbase install directory or the path to pg_config 啓用PostgreSQL支持並指定其軟件根目錄或者pg_config的路徑
--disable-posix Disable POSIX-like functions 禁用POSIX-like支持
--with-pspell[=DIR] Include PSPELL support. Aspell version 0.50.0 or higher required 包含PSPELL支持GNU
--with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only) 包含libedit readline更換(僅用於CLI和CGI)
--with-readline[=DIR] Include readline support (CLI/CGI only)包含readline支持(僅用於CLI和CGI)
--with-recode[=DIR] Include recode support 包含recode支持
--disable-reflection Disable reflection support 禁用reflection支持。
--disable-session Disable session support 禁用session支持
--with-mm[=DIR] SESSION: Include mm support for session storage 爲session存儲啓用mm支持。
--enable-shmop Enable shmop support 啓用shmop支持
--disable-simplexml Disable SimpleXML support 禁用simpleXML支持
--with-libxml-dir=DIR SimpleXML: libxml2 install prefix 啓用simpleXML:libXML2支持。
--with-snmp[=DIR] Include SNMP support 包含SNMP支持。
--with-openssl-dir[=DIR] SNMP: openssl install prefix 包含SNMP:openssl支持
--enable-ucd-snmp-hack SNMP: Enable UCD SNMP hack SNMP hack 包含UCD
--enable-soap Enable SOAP support 啓用SOAP支持
--with-libxml-dir=DIR SOAP: libxml2 install prefix 啓用SOAP:LIBXML2支持。
--enable-sockets Enable sockets support 啓用sockets支持
--disable-spl Disable Standard PHP Library 禁用標準PHP庫
--without-sqlite=DIR Do not include sqlite support. DIR is the sqlite base install directory [BUNDLED] 不包含sqlite支持。
--enable-sqlite-utf8 SQLite: Enable UTF-8 support for SQLite 啓用SQLite的UTF-8支持。
--with-regex=TYPE regex library type: system, apache, php. [TYPE=php] WARNING: Do NOT use unless you know what you are doing! 正則表達式庫類型。
--with-sybase[=DIR] Include Sybase-DB support. DIR is the Sybase home directory [/home/sybase] 包含Sybase-DB支持。
--with-sybase-ct[=DIR] Include Sybase-CT support. DIR is the Sybase home directory [/home/sybase] 包含Sybase-CT支持。
--enable-sysvmsg Enable sysvmsg support 啓用sysvmsg支持。
--enable-sysvsem Enable System V semaphore support 啓用系統V信號支持
--enable-sysvshm Enable the System V shared memory support 啓用系統V共享內存支持。
--with-tidy[=DIR] Include TIDY support 包含tidy支持。
--disable-tokenizer Disable tokenizer support 禁用tokenizer支持
--enable-wddx Enable WDDX support 啓用WDDX支持
--with-libxml-dir=DIR WDDX: libxml2 install prefix 包含WDDX:libxml2支持。
--with-libexpat-dir=DIR WDDX: libexpat dir for XMLRPC-EPI (deprecated) 爲XMLRPC-EPI啓用libexpat(不推薦)
--disable-xml Disable XML support 禁用XML支持。
--with-libxml-dir=DIR XML: libxml2 install prefix 啓用libxml2支持
--with-libexpat-dir=DIR XML: libexpat install prefix (deprecated) 啓用libexpat支持(不推薦)
--disable-xmlreader Disable XMLReader support 禁用XMLreader支持。
--with-libxml-dir=DIR XMLReader: libxml2 install prefix 啓用XMLreader的libxml2支持。
--with-xmlrpc[=DIR] Include XMLRPC-EPI support 包含XMLRPC-EPI支持
--with-libxml-dir=DIR XMLRPC-EPI: libxml2 install prefix 啓用XMLRPC-EPI:libxml2支持
--with-libexpat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI (deprecated) 啓用XMLRPC-EPI:libexpat支持(不推薦)
--with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI 啓用XMLRPC-EPI:iconv支持
--disable-xmlwriter Disable XMLWriter support 禁用XMLWriter支持
--with-libxml-dir=DIR XMLWriter: libxml2 install prefix 啓用XMLReader:libxml2支持。
--with-xsl[=DIR]
Include XSL support. DIR is the libxslt base install directory (libxslt >= 1.1.0 required)
啓用XSL支持
--enable-zip Include Zip read/write support 包含zip讀寫支持
--with-zlib-dir[=DIR] ZIP: Set the path to libz install prefix 啓用zip:zlib支持

PEAR(PEAR相關選項):

--with-pear=DIR Install PEAR in DIR [PREFIX/lib/php] 在目錄中安裝pear
--without-pear Do not install PEAR 禁用pear

Zend(ZEND相關選項):

--with-zend-vm=TYPE Set virtual machine dispatch method. Type is one of CALL, SWITCH or GOTO [TYPE=CALL] 設置虛擬機調度方法,參數爲CALL, SWITCH或GOTO
--enable-maintainer-zts Enable thread safety - for code maintainers only!! 啓用線程安全模式(僅用於代碼維護人員使用)
--disable-inline-optimization If building zend_execute.lo fails, try this switch 如果編譯zend_execute.lo失敗,則使用此參數
--enable-zend-multibyte Compile with zend multibyte support 編譯zend多字節支持。

TSRM(Thread Safe Resource Manager線程安全資源管理器相關配置):

--with-tsrm-pth[=pth-config] Use GNU Pth 使用GNU方式管理線程
--with-tsrm-st Use SGI's State Threads 使用SGI靜態線程方式管理線程
--with-tsrm-pthreads Use POSIX threads (default) 使用POSIX線程方式管理線程

Libtool(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]
假設C編譯器使用GNU ld
--disable-libtool-lock
avoid locking (might break parallel builds)
避免鎖死(可能破壞並聯的編譯)
--with-pic try to use only PIC/non-PIC objects [default=use both] 嘗試僅使用PIC或non-PIC對象
--with-tags[=TAGS] include additional configurations [automatic] 包括額外的配置

3、編譯參數

./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/php.ini --with-apxs2=/usr/local/apache/bin/apxs --with-mm=/usr/local/mm/ --with-pear --with-openssl --with-zlib --with-pcre-dir --with-mcrypt --with-mhash --with-mysql --with-pdo-mysql --with-libxml-dir --enable-fastcgi  --enable-discard-path --enable-magic-quotes --enable-static --enable-mbstring  --enable-shmop --enable-wddx --enable-sockets

make

make install

cp php.ini-production /usr/local/php/etc/php.ini

四、服務配置

1、php.ini文件說明

[PHP]

;;;;;;;;;;;;;;;;;;;
; About php.ini   ;
;;;;;;;;;;;;;;;;;;;
;PHP基本說明
;PHP初始化文件,用於配置php運行參數
;PHP嘗試查找和加載此配置文件的順序:1、SAPI指定位置2、PHPRC環境變量3、Windows註冊表的指定位置4、當前工作目錄(CLI除外)5、web服務器目錄(SAPI模塊)或者PHP目錄位置6、編譯時--with-config-file-path的指定目錄。
;PHP註釋:空白,分號開頭的,以及段落的[XXX]都可以被忽略,雖然將來可能用的。
;PHP作用域:指令[PATH=/www/mysite]僅僅適用於目錄/www/mysite中的php文件;[HOST=www.example.com]僅僅對www.example.com中的php文件起作用。目前,[PATH=]和[HOST=]僅僅工作在CGI和FastCGI中。特別的字段不能對用戶單獨的設置覆蓋,即設置以用戶單獨設置的爲準。
;PHP指令說明:語法:指令=值;指令區分大小寫;指令定義的變量用於配置PHP或PHP擴展;無名稱驗證,如果php找不到指定的指令或指令配置錯誤,則啓用默認值;指令的值可以是:字符串,數字,php常量,INI常量(On,Off,True,False,Yes,No,None),帶引號的字符串,先前設置的變量或者指令引用;表達式限於操作符或者括號|(OR)^(XOR)&(AND)~(NOT)!(NOT);布爾值:真可以是1,On,Ture,Yes假值可以爲0,Off,False,No;空值:可以是None或者空白(即什麼都不寫);如果你在值中使用常量,並且這些常量屬於動態加載的模塊(PHP擴展或Zend擴展),你只能在擴展中加載了後再使用這個變量(即變量要先定義後使用)
;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.

; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
; 1. SAPI module specific location.
; 2. The PHPRC environment variable. (As of PHP 5.2.0)
; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0)
; 4. Current working directory (except CLI)
; 5. The web server's directory (for SAPI modules), or directory of PHP
; (otherwise in Windows)
; 6. The directory from the --with-config-file-path compile time option, or the
; Windows directory (C:\windows or C:\winnt)
; See the PHP docs for more specific information.
http://php.net/configuration.file

; The syntax of the file is extremely simple.  Whitespace and Lines
; beginning with a semicolon are silently ignored (as you probably guessed).
; Section headers (e.g. [Foo]) are also silently ignored, even though
; they might mean something in the future.

; Directives following the section heading [PATH=/www/mysite] only
; apply to PHP files in the /www/mysite directory.  Directives
; following the section heading [HOST=www.example.com] only apply to
; PHP files served from www.example.com.  Directives set in these
; special sections cannot be overridden by user-defined INI files or
; at runtime. Currently, [PATH=] and [HOST=] sections only work under
; CGI/FastCGI.
http://php.net/ini.sections

; Directives are specified using the following syntax:
; directive = value
; Directive names are *case sensitive* - foo=bar is different from FOO=bar.
; Directives are variables used to configure PHP or PHP extensions.
; There is no name validation.  If PHP can't find an expected
; directive because it is not set or is mistyped, a default value will be used.

; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one
; of the INI constants (On, Off, True, False, Yes, No and None) or an expression
; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a
; previously set variable or directive (e.g. ${foo})

; Expressions in the INI file are limited to bitwise operators and parentheses:
; |  bitwise OR
; ^  bitwise XOR
; &  bitwise AND
; ~  bitwise NOT
; !  boolean NOT

; Boolean flags can be turned on using the values 1, On, True or Yes.
; They can be turned off using the values 0, Off, False or No.

; An empty string can be denoted by simply not writing anything after the equal
; sign, or by using the None keyword:

;  foo =         ; sets foo to an empty string
;  foo = None    ; sets foo to an empty string
;  foo = "None"  ; sets foo to the string 'None'

; If you use constants in your value, and these constants belong to a
; dynamically loaded extension (either a PHP extension or a Zend extension),
; you may only use these constants *after* the line that loads the extension.

;;;;;;;;;;;;;;;;;;;
; About this file ;
;;;;;;;;;;;;;;;;;;;
;PHP自帶文件說明
;PHP自帶了兩個文件,一個用於生產環境,另一個用於開發環境。php.ini-production在內核中包含了安全,性能和最佳做法的設置;但是請注意,這些設置可能破壞和老版本的兼容性和極少的安全良心應用;我們建議在生產和測試環境中使用此文件。php.ini-development和生產版本非常相似,除了它出錯後提供的詳細信息;建議僅在開發環境中使用此文件,否則錯誤輸出到程序導致用戶在不經意間泄露安全信息。
; PHP comes packaged with two INI files. One that is recommended to be used
; in production environments and one that is recommended to be used in
; development environments.

; php.ini-production contains settings which hold security, performance and
; best practices at its core. But please be aware, these settings may break
; compatibility with older or less security conscience applications. We
; recommending using the production ini in production and testing environments.

; php.ini-development is very similar to its production variant, except it's
; much more verbose when it comes to errors. We recommending using the
; development version only in development environments as errors shown to
; application users can inadvertently leak otherwise secure information.

;;;;;;;;;;;;;;;;;;;
; Quick Reference ;
;;;;;;;;;;;;;;;;;;;
;快速參考
;以下是關於在INI文件中生產和開發環境中的默認行爲的區別。請查看文檔後面的實際設置來得到更多詳細的信息,從而可以看出我們做這些變化的原因。
; The following are all the settings which are different in either the production
; or development versions of the INIs with respect to PHP's default behavior.
; Please see the actual settings later in the document for more details as to why
; we recommend these changes in PHP's behavior.

; allow_call_time_pass_reference
;   Default Value: On
;   Development Value: Off
;   Production Value: Off

; display_errors
;   Default Value: On
;   Development Value: On
;   Production Value: Off

; display_startup_errors
;   Default Value: Off
;   Development Value: On
;   Production Value: Off

; error_reporting
;   Default Value: E_ALL & ~E_NOTICE
;   Development Value: E_ALL | E_STRICT
;   Production Value: E_ALL & ~E_DEPRECATED

; html_errors
;   Default Value: On
;   Development Value: On
;   Production value: Off

; log_errors
;   Default Value: Off
;   Development Value: On
;   Production Value: On

; magic_quotes_gpc
;   Default Value: On
;   Development Value: Off
;   Production Value: Off

; max_input_time
;   Default Value: -1 (Unlimited)
;   Development Value: 60 (60 seconds)
;   Production Value: 60 (60 seconds)

; output_buffering
;   Default Value: Off
;   Development Value: 4096
;   Production Value: 4096

; register_argc_argv
;   Default Value: On
;   Development Value: Off
;   Production Value: Off

; register_long_arrays
;   Default Value: On
;   Development Value: Off
;   Production Value: Off

; request_order
;   Default Value: None
;   Development Value: "GP"
;   Production Value: "GP"

; session.bug_compat_42
;   Default Value: On
;   Development Value: On
;   Production Value: Off

; session.bug_compat_warn
;   Default Value: On
;   Development Value: On
;   Production Value: Off

; session.gc_divisor
;   Default Value: 100
;   Development Value: 1000
;   Production Value: 1000

; session.hash_bits_per_character
;   Default Value: 4
;   Development Value: 5
;   Production Value: 5

; short_open_tag
;   Default Value: On
;   Development Value: Off
;   Production Value: Off

; track_errors
;   Default Value: Off
;   Development Value: On
;   Production Value: Off

; url_rewriter.tags
;   Default Value: "a=href,area=href,frame=src,form=,fieldset="
;   Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry"
;   Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry"

; variables_order
;   Default Value: "EGPCS"
;   Development Value: "GPCS"
;   Production Value: "GPCS"


2、配置Apache使之支持PHP

vi /usr/local/apache/conf/httpd.conf

修改如下三處:

LoadModule php5_module        modules/libphp5.so
<IfModule dir_module>
    DirectoryIndex index.php index.htm index.html
</IfModule>
<IfModule mime_module>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
</IfModule>

在apache的默認站點目錄下建立文件index.php
代碼示例:
<?php
date_default_timezone_set('UTC');
phpinfo();
?>
重新啓動apache,輸入網址測試。

五、運行維護

 

參考文摘:
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章