As Thani said, it will complain about a lot of libXML depend extensions. Here are all the ones I had to disable:
--disable-libxml --disable-dom --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear
配置选项
核心配置选项列表
下面是 PHP 的 configure 脚本使用的部分选项的列表,用于类 Unix 环境的编译。大部分配置选项在扩展模块参考页面适当的位置列出,而不是在这里。要查看所有可用配置选项的列表,在运行 autoconf 命令后在 PHP 的源代码目录运行 ./configure --help(参见安装与配置一章)。也可以阅读 » GNU configure 文档以获得有关 configure 命令的更详细信息,例如 --prefix=PREFIX。
Note: 这些选项只用在编译的时候。如果想要修改 PHP 的运行时配置,请阅读运行时配置。
在 PHP 4 中的配置选项
Note: 这些选项仅适用于 PHP 4.1.0 以上版本。尽管某些选项可以用在较旧版本的 PHP 4,甚至 PHP 3,如果想编译旧版本的 PHP,请注意有些选项不可用。
杂项选项
- --enable-debug
-
编译时加入调试符号。
- --with-layout=TYPE
-
设置被安装文件的布局。TYPE 是 PHP(默认)或 GNU。
- --with-pear=DIR
-
在 DIR(默认为 PREFIX/lib/php)中安装 PEAR。
- --without-pear
-
不安装 PEAR。
- --enable-sigchild
-
使用 PHP 自带的 SIGCHLD 处理器。
- --disable-rpath
-
禁用在搜索路径中传递其他运行库。
- --enable-libgcc
-
启用 libgcc 的精确链接。
- --enable-php-streams
-
包含试验性的 PHP 流。不要使用此选项,除非是要测试代码!
- --with-zlib-dir[=DIR]
-
定义 zlib 的安装目录。
- --enable-trans-sid
-
启用透明 session id 传输。仅适用于 PHP 4.1.2 或更低版本。PHP 4.2.0 以后,透明 sid 功能默认被编译其中。
- --with-tsrm-pthreads
-
使用 POSIX 线程(默认)。
-
编译共享库 [default=yes]。
- --enable-static[=PKGS]
-
编译静态库 [default=yes]。
- --enable-fast-install[=PKGS]
-
为快速安装优化 [default=yes]。
- --with-gnu-ld
-
假设 C 编译器使用 GNU ld [default=no]。
- --disable-libtool-lock
-
避免锁死(可能破坏并联的编译)。
- --with-pic
-
尝试仅使用 PIC/非 PIC 对象 [default=use both]。
- --enable-memory-limit
-
编译内存限制支持功能。
- --disable-url-fopen-wrapper
-
禁用 URL 形式的 fopen 封装协议。该协议允许通过 HTTP 或者 FTP 访问文件。
- --enable-versioning
-
仅导出必须的符号。查看 INSTALL 文件以获得更多信息。
- --with-imsp[=DIR]
-
包含 IMSP 支持(DIR 是 IMSP 的 include 目录和 libimsp.a 所在目录)。此选项仅在 PHP 3 中有效!
- --with-mck[=DIR]
-
包含 Cybercash MCK 支持。DIR 是 cybercash mck 的编译目录,默认为 /usr/src/mck-3.2.0.3-linux。更多帮助情查看 extra/cyberlib 内的文件。此选项仅在 PHP 3 中有效!
- --with-mod-dav=DIR
-
通过 Apache 的 mod_dav 实现对 DAV 的支持。DIR 是 mod_dav 的安装目录 (仅对以 Apache 模块方式安装的 PHP 有效)。此选项仅在 PHP 3 中有效!
- --enable-debugger
-
编译远程调试功能。此选项仅在 PHP 3 中有效!
- --enable-versioning
-
利用 Solaris 2.x 和 Linux 提供的版本管理(versioning)和范围(scoping)。此选项仅在 PHP 3 中有效!
PHP 选项
- --enable-maintainer-mode
-
对偶然安装一下的情形启用此选项,使得不检查编译规则和依赖关系。
- --with-config-file-path=PATH
-
设置 php.ini 的搜索路径。默认为 PREFIX/lib。
- --enable-safe-mode
-
默认启用安全模式。
- --with-exec-dir[=DIR]
-
在安全模式时仅允许在 DIR 目录中执行。默认目录为 /usr/local/php/bin。
- --enable-magic-quotes
-
默认启用 magic quotes。
-
默认禁用短形式的开始标签 <? 。
SAPI 选项
下面的列表包含 PHP 可用的SAPI(服务器应用编程接口)。
- --with-aolserver=DIR
-
指定 AOLserver 的安装路径。
- --with-apxs[=FILE]
-
编译共享的 Apache 模块。FILE 是可选的 Apache apxs 工具的路径,默认指向 apxs。请确认指定的 apxs 已经安装在服务器中,并且它不是 Apache 源码包中的那个 apxs。
- --with-apache[=DIR]
-
编译静态 Apache 模块。DIR 是 Apache 编译目录的顶层,默认为 /usr/local/apache。
- --with-mod_charset
-
启用 mod_charset 的转换表(俄文的 Apache 使用)。
- --with-apxs2[=FILE]
-
编译共享的 Apache 2.0 模块。FILE 是可选的 Apache apxs 工具的路径,默认指向 apxs。
- --with-caudium=DIR
-
为使用 Caudium 编译 PHP 为一个 Pike 模块。DIR 是 Caudium 服务器目录,默认为 /usr/local/caudium/server。
- --disable-cli
-
PHP 4.3.0 之后的版本有效。禁止编译 PHP 的 CLI 版本(使用它将同时强制使用 --without-pear 选项)。更多信息请查考 PHP 的命令行模式。
- --enable-embed[=TYPE]
-
启用编译嵌入的 SAPI 库。TYPE 或者为 shared 或者为 static,默认为 shared。PHP 4.3.0 之后的版本有效。
- --with-fhttpd[=DIR]
-
编译 fhttpd 模块。DIR 是 fhttpd 源代码目录,默认为 /usr/local/src/fhttpd。PHP 4.3.0 及以后的版本此选项不再有效。
- --with-isapi=DIR
-
为 Zeus 服务器以 ISAPI 模块方式编译 PHP。
- --with-nsapi=DIR
-
指定 Netscape/iPlanet/SunONE 的安装目录。
- --with-phttpd=DIR
-
还没有信息。
- --with-pi3web=DIR
-
为 Pi3Web 服务器编译 PHP 模块。
- --with-roxen=DIR
-
以 Pike 模块方式编译 PHP。DIR 是 Roxen 的根目录,默认为 /usr/local/roxen/server。
- --enable-roxen-zts
-
使用 Zend 线程安全(ZTS)编译 Roxen 模块。
- --with-servlet[=DIR]
-
包含 servlet 支持。DIR 是 JSDK 的安装目录。此 SAPI 要求 java 扩展必须作为共享模块编译到 PHP 中。
- --with-thttpd=SRCDIR
-
编译 PHP 为 thttpd 模块。
- --with-tux=MODULEDIR
-
编译 PHP 为 TUX 模块(仅在 Linux 下有效)。
- --with-webjames=SRCDIR
-
编译 PHP 为 WebJames 模块(仅在 RISC 操作系统中有效)。
- --disable-cgi
-
禁止编译 CGI 版本的 PHP。PHP 4.3.0 之后的版本有效。
- --enable-force-cgi-redirect
-
启用内部服务器重定向的安全检测。如果在 Apache 下使用 CGI 版本的 PHP,请启用该选项。
- --enable-discard-path
-
如果启用该选项,PHP CGI 目录可以安全的放在 web 目录树的外面,人们无法避开 .htaccess 的安全限制。
- --with-fastcgi
-
编译 PHP 为 FastCGI 应用程序。PHP 4.3.0 及以后的版本此选项不再有效,应该使用 --enable-fastcgi 选项。
- --enable-fastcgi
-
如果启用,CGI 模块将被编译为支持 FastCGI。PHP 4.3.0 之后的版本有效。
- --disable-path-info-check
-
如果该选项被禁用,例如 /info.php/test?a=b 形式的路径将不能工作。PHP 4.3.0 之后的版本有效。更多信息请参考 » Apache 手册。
配置选项
10-Jan-2009 12:23
22-Jul-2008 12:35
One of the above mentioned to enable libxml. Instead use disable-all and enable only the required extensions. Otherwise it will complain of libxml for extensions that depend on libxml.
04-Mar-2008 04:07
If you have compiled php without specifying a --with-config-file-path=PATH
then reconfigure php using --with-config-file-path=PATH, you must do a "make clean" then "make" & "make install" before reinstalling. If you don't make clean first, phpinfo will report the new location set by --with-config-file-path=PATH, but actually be looking for php.ini in the old location.
I'm not sure if this is intended behavior or not but this is a gotcha that got me after compiling, then reconfiguring, then doing make install. It caused a little head scratching.
It's good practice to do make clean after any configuration change anyway. Bite the bullet and take the time to do it right to avoid unexpected module behavior.
-Neil
07-Feb-2008 08:52
It's not stated clearly anywhere in the documentation, but the CGI version won't build if you specify the --with-apxs= option to configure (the CLI version will, however). The only way I found to have *both* Apache module *and* CGI versions of PHP installed was to run configure/make twice - first with --with-apxs= option, to build the Apache module, then without it, to build the CGI binary.
I think if the doc says that the CGI version is built by default, it *should* be built by default, unless you specify --disable-cgi. If --with-apxs= automatically disables CGI, the --disable-cgi option doesn't seem to have any use.
30-Nov-2006 09:26
Note: PHP5 has a zillion dependencies on libxml, it is not practical to disable it, you must install it.
libxml can be found here: http://www.xmlsoft.org/
But this is actualy a good thing; "Almost everything regarding XML support was rewritten for PHP 5".
For more info see: http://www.zend.com/php5/articles/php5-xmlphp.php
09-Jul-2005 01:26
If you'e compiling a shared extension (e.g. pspell) whose libs & headers are not in the usual place, use the following:
--with-pspell=shared,/my/custom/path/to/pspell/
Took me forever to figure out, since Google had no answer for me.
14-Apr-2005 07:15
If some options do not become active after doing a configure; make; make install, try to do a make clean after configure. That worked for me when enabling memory limts (--enable-memory-limit).
>/usr/local/lib needs to be listed in /etc/ld.so.conf, but it should already
>be there on most systems. The above notes all apply to Linux only,
>but may be useful on other platforms as well
It is much simpler just to put /usr/local/pgsql/lib into /etc/ld.so.conf and then run ldconfig.
06-Oct-2003 12:32
If you're trying to build with --with-imap and your uw-imap stuff is built SSLTYPE=nopwd then you will fail the "Checking if IMAP works" check if you don't also build with --with-imap-ssl
Another hour and a half of my life lost to find that one.
Steve
14-Aug-2002 07:06
[Editor's note: The reason why some general options for the "configure" scripts are not documented is that said script is part of the GNU autoconf tools, and as such its general options are documented elsewhere, e.g.: http://www.gnu.org/manual/autoconf/index.html and http://www.airs.com/ian/configure/. Some are also documented in the INSTALL file that comes with the source distribution.]
The --prefix=PREFIX configure option isn't mentioned here. It apparently defaults to /usr/local, and sets the position of the php includes and libs. (in PREFIX/include/php and PREFIX/lib/php)
15-Apr-2002 05:42
RE: Servlet support, I found that you need to configure --with-servlet=/usr/local/tomcat/common.
I found checking the configure script (always a good idea) that it looks for {dir_prefix}/lib/servlet.jar file, and this is found in the tomcat/common directory.
Hope this helps a bit!
14-Aug-2001 07:05
--enable-sigchild is only relevent to users of Oracle who are having <defunc> processes.
03-Nov-2000 06:27
If you are building with --with-pgsql=/some/dir, make sure that you still have libpq loaded up by ldconfig. I compiled and installed postgres from the tarball and then had to manually create the symlinks in /usr/local/lib. In particular, after you have built and installed postgres, you need to do the following (presuming you installed to /usr/local/pgsql):
# cd /usr/local/lib
# ln -s ../pgsql/lib/libpq.so.2.1 libpq.so.2.1
# ln -s ../pgsql/lib/libpq.so.2.1 libpq.so.2
# ln -s ../pgsql/lib/libpq.so.2.1 libpq.so
# ldconfig
/usr/local/lib needs to be listed in /etc/ld.so.conf, but it should already be there on most systems. The above notes all apply to Linux only, but may be useful on other platforms as well.
--sam
