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-createconfigure脚本运行结束后不输出结果文件,常用于正式编译前的测试。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可改写的体系无关数据目录DIRmodifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR可改写的单一机器数据目录DIRmodifiable single-machine data [PREFIX/var]
--libdir=DIR对象代码库目录DIRobject code libraries [EPREFIX/lib]
--includedir=DIRPHP的C头文件目录DIRC header files [PREFIX/include]
--oldincludedir=DIR非gcc的C头文件目录DIRC header files for non-gcc [/usr/include]
--datadir=DIRPHP服务器只读的体系无关数据目录DIRread-only architecture-independent data [DATAROOTDIR]
--infodir=DIR信息文档目录DIRinfo documentation [DATAROOTDIR/info]
--localedir=DIR地区相关数据DIRlocale-dependent data [DATAROOTDIR/locale]
--mandir=DIR手册文档目录DIRman 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指定编译工具所在系统的系统类型BUILDconfigure for building on BUILD [guessed]
--host=HOST指定Apache HTTP服务器将要进行交叉编译时运行的目标系统类型HOSTcross-compile to build programs to run on HOST [BUILD]
--target=TARGET指定交叉编译所产生的目标代码类型configure for building compilers for TARGET [HOST]

特征选项:

--disable-FEATUREdo not include FEATURE (same as --enable-FEATURE=no)关闭特征选项
--enable-FEATURE[=ARG]include FEATURE [ARG=yes]启用特征选项
--with-PACKAGE[=ARG]use PACKAGE [ARG=yes]使用封装
--without-PACKAGEdo not use PACKAGE (same as --with-PACKAGE=no)禁用封装
--x-includes=DIRX include files are in DIR在目录中包含X头文件
--x-libraries=DIRX library files are in DIR在目录中包含X库文件
--with-libdir=NAMELook for libraries in .../NAME rather than .../lib库文件查找路径设置.../XXX/lib/
--disable-rpathDisable passing additional runtime library search paths禁用传递其他运行库搜索路径

SAPI modules(SAPI模块设置):

--with-aolserver=DIRSpecify 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-charsetAPACHE: 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-charsetAPACHE (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-cliDisable building CLI version of PHP编译禁用CLI的PHP版本。这个参数需要--without-pear (this forces --without-pear)
--with-continuity=DIRBuild 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=DIRBuild PHP as NSAPI module for Netscape/iPlanet/Sun Webserver为Netscape/iPlanet/Sun Web服务器编译PHP为NSAPI模块。
--with-phttpd=DIRBuild PHP as phttpd module编译PHP为phttpd模块
--with-pi3web[=DIR]Build PHP as Pi3Web module编译PHP为Pi3web模块
--with-roxen=DIRBuild PHP as a Pike module. DIR is the base Roxen directory, normally /usr/local/roxen/server编译PHP为Pike模块。参数为ROXEN软件的路径。
--enable-roxen-ztsROXEN: Build the Roxen module using Zend Thread Safety编译Roxen的模块,使用Zend线程安全模式。
--with-thttpd=SRCDIRBuild PHP as thttpd module编译PHP为thttpd模块
--with-tux=MODULEDIRBuild PHP as a TUX module (Linux only)编译PHP为TUX模块(仅适用于linux下)
--with-webjames=SRCDIRBuild PHP as a WebJames module (RISC OS only)编译PHP为WebJames模块(仅适用于RISC系统)
--disable-cgiDisable building CGI version of PHP编译禁用CGI的PHP版本
--enable-fastcgiCGI: Enable FastCGI support in the CGI binary在CGI二进制中启用FastCGI。
--enable-force-cgi-redirectCGI: 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-checkCGI: 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-gcovEnable GCOV code coverage (requires LTP) - FOR DEVELOPERS ONLY!!请用GCOV代码覆盖率(仅用于开发人员使用)
--enable-debugCompile with debugging symbols带调试符号的编译
--with-layout=TYPESet how installed files will be laid out. Type can be either PHP or GNU [PHP]显示安装文件的布局。参数为PHP或GNU
--with-config-file-path=PATHSet the path in which to look for php.ini [PREFIX/lib]php.ini文件位置
--with-config-file-scan-dir=PATHSet the path where to scan for configuration files扫描配置文件的路径
--enable-safe-modeEnable safe mode by default启用默认的安全模式
--with-exec-dir[=DIR]Only allow executables in DIR under safe-mode [/usr/local/php/bin]在安全模式目录下仅允许可执行文件
--enable-sigchildEnable PHP's own SIGCHLD handler使用PHP自带的SIGCHLD处理器
--enable-magic-quotesEnable magic quotes by default.默认激活magic quotes。可让程序在执行时自动加入反斜线的引入字符。
--enable-libgccEnable explicitly linking against libgcc启用libgcc的精确链接
--disable-short-tagsDisable the short-form <? start tag by default默认禁用短形式的<?作为php代码的开始标记
--enable-dmallocEnable dmalloc启用dmalloc(dmalloc是Linux C编程侦测记忆体溢出工具)
--disable-ipv6Disable IPv6 support禁用IPv6支持
--enable-fd-setsizeSet 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-allDisable all extensions which are enabled by default关闭默认为启用的所有扩展功能
--disable-libxmlDisable LIBXML support禁用LIBXML支持
--with-libxml-dir[=DIR]LIBXML: libxml2 install prefixLIBXML安装目录
--with-openssl[=DIR]Include OpenSSL support (requires OpenSSL >= 0.9.6)启用openssl支持
--with-kerberos[=DIR]OPENSSL: Include Kerberos support包含kerberos支持
--without-pcre-regexDo 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-bcmathEnable bc style precision math functions启用bcmatch(公元前风格精度数学)
--with-bz2[=DIR]Include BZip2 support包含BZip2支持
--enable-calendarEnable support for calendar conversion启用日历转换支持
--disable-ctypeDisable ctype functions禁用ctype功能
--with-curl[=DIR]Include cURL support启用cURL支持
--with-curlwrappersUse cURL for url streams使用cURL作为网址流
--enable-dbaBuild 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-inifileDBA: INI support (bundled)启用INI支持(捆绑方式)
--disable-flatfileDBA: FlatFile support (bundled)启用QDBM支持(捆绑方式)
--enable-dbaseEnable the bundled dbase library启用捆绑的dbase库
--disable-domDisable DOM support禁用DOM支持
--with-libxml-dir[=DIR]DOM: libxml2 install prefix启用libxml2并指定其安装目录
--enable-exifEnable 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-filterDisable input filter support禁用输入过滤支持
--with-pcre-dirFILTER: pcre install prefix pcre支持及其安装目录
--enable-ftpEnable 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-ttfGD: Enable TrueType string function启用TureType字符功能
--enable-gd-jis-convGD: 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-hashDisable 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-jsonDisable JavaScript Object Serialization support禁用JavaScript对象顺序话支持
--with-ldap[=DIR]Include LDAP support包含LDAP支持
--with-ldap-sasl[=DIR]LDAP: Include Cyrus SASL support包含Cyrus SASL支持
--enable-mbstringEnable multibyte string support启用多字节字符串的支持
--disable-mbregexMBSTRING: Disable multibyte regex support禁用多字节正则表达式的支持
--disable-mbregex-backtrackMBSTRING: 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-mysqliMYSQLi: 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-pcntlEnable pcntl support (CLI/CGI only)启用pcntl支持。
--disable-pdoDisable 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,dirPDO: 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-posixDisable 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-reflectionDisable reflection support禁用reflection支持。
--disable-sessionDisable session support禁用session支持
--with-mm[=DIR]SESSION: Include mm support for session storage为session存储启用mm支持。
--enable-shmopEnable shmop support启用shmop支持
--disable-simplexmlDisable SimpleXML support禁用simpleXML支持
--with-libxml-dir=DIRSimpleXML: 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-hackSNMP: Enable UCD SNMP hack SNMP hack包含UCD
--enable-soapEnable SOAP support启用SOAP支持
--with-libxml-dir=DIRSOAP: libxml2 install prefix启用SOAP:LIBXML2支持。
--enable-socketsEnable sockets support启用sockets支持
--disable-splDisable Standard PHP Library禁用标准PHP库
--without-sqlite=DIRDo not include sqlite support. DIR is the sqlite base install directory [BUNDLED]不包含sqlite支持。
--enable-sqlite-utf8SQLite: Enable UTF-8 support for SQLite启用SQLite的UTF-8支持。
--with-regex=TYPEregex 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-sysvmsgEnable sysvmsg support启用sysvmsg支持。
--enable-sysvsemEnable System V semaphore support启用系统V信号支持
--enable-sysvshmEnable the System V shared memory support启用系统V共享内存支持。
--with-tidy[=DIR]Include TIDY support包含tidy支持。
--disable-tokenizerDisable tokenizer support禁用tokenizer支持
--enable-wddxEnable WDDX support启用WDDX支持
--with-libxml-dir=DIRWDDX: libxml2 install prefix包含WDDX:libxml2支持。
--with-libexpat-dir=DIRWDDX: libexpat dir for XMLRPC-EPI (deprecated)为XMLRPC-EPI启用libexpat(不推荐)
--disable-xmlDisable XML support禁用XML支持。
--with-libxml-dir=DIRXML: libxml2 install prefix启用libxml2支持
--with-libexpat-dir=DIRXML: libexpat install prefix (deprecated)启用libexpat支持(不推荐)
--disable-xmlreaderDisable XMLReader support禁用XMLreader支持。
--with-libxml-dir=DIRXMLReader: libxml2 install prefix启用XMLreader的libxml2支持。
--with-xmlrpc[=DIR]Include XMLRPC-EPI support包含XMLRPC-EPI支持
--with-libxml-dir=DIRXMLRPC-EPI: libxml2 install prefix启用XMLRPC-EPI:libxml2支持
--with-libexpat-dir=DIRXMLRPC-EPI: libexpat dir for XMLRPC-EPI (deprecated)启用XMLRPC-EPI:libexpat支持(不推荐)
--with-iconv-dir=DIRXMLRPC-EPI: iconv dir for XMLRPC-EPI启用XMLRPC-EPI:iconv支持
--disable-xmlwriterDisable XMLWriter support禁用XMLWriter支持
--with-libxml-dir=DIRXMLWriter: 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-zipInclude Zip read/write support包含zip读写支持
--with-zlib-dir[=DIR]ZIP: Set the path to libz install prefix启用zip:zlib支持

PEAR(PEAR相关选项):

--with-pear=DIRInstall PEAR in DIR [PREFIX/lib/php]在目录中安装pear
--without-pearDo not install PEAR禁用pear

Zend(ZEND相关选项):

--with-zend-vm=TYPESet virtual machine dispatch method. Type is one of CALL, SWITCH or GOTO [TYPE=CALL]设置虚拟机调度方法,参数为CALL, SWITCH或GOTO
--enable-maintainer-ztsEnable thread safety - for code maintainers only!!启用线程安全模式(仅用于代码维护人员使用)
--disable-inline-optimizationIf building zend_execute.lo fails, try this switch如果编译zend_execute.lo失败,则使用此参数
--enable-zend-multibyteCompile with zend multibyte support编译zend多字节支持。

TSRM(Thread Safe Resource Manager线程安全资源管理器相关配置):

--with-tsrm-pth[=pth-config]Use GNU Pth使用GNU方式管理线程
--with-tsrm-stUse SGI's State Threads使用SGI静态线程方式管理线程
--with-tsrm-pthreadsUse 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-pictry 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,输入网址测试。

五、运行维护

 

参考文摘:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值