0

我注意到我在开发盒上使用的 PHP make 没有启用 xmlreader 和 xmlwriter 扩展。我知道我需要重新编译 PHP 以启用这些扩展(或者可能更准确地删除禁用,因为它们是默认启用的?),但是我在我需要运行的地方建立连接时遇到了问题./configure 和 make 命令。

这是来自 phpinfo() 输出的配置命令:

'./configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' \
 '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' \
 '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' \
 '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' \
 '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' \
 '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' \
 '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' \
 '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' \
 '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' \
 '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' \
 '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' \
 '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/usr' \
 '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' \
 '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' \
 '--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' \
 '--enable-calendar' '--without-mime-magic' '--without-sqlite' \
 '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' \
 '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--disable-dom' \
 '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' \
 '--disable-xmlwriter' '--without-sqlite3' '--disable-phar' '--disable-fileinfo' \
 '--disable-json' '--without-pspell' '--disable-wddx' '--without-curl' \
 '--disable-posix' '--disable-sysvmsg' '--disable-sysvshm' '--disable-sysvsem' 

请注意,它是使用 --disable-xmlreader 和 --disable-xmlwriter 编译的。根据http://www.php.net/manual/en/xmlwriter.installation.php上的文档,我看到这个扩展是默认启用的。我将如何“撤消”此扩展禁用?

我的目标是能够使用 PHPExcel 类集 ( http://phpexcel.codeplex.com/ ),但由于其中一个类试图扩展 XMLWriter 类而遇到致命错误。

4

2 回答 2

2

如果您使用的是具有二进制包的发行版之一(如 openSUSE) - 您可能只想安装 php-xmlwriter 包作为扩展。

另一种选择 - 只需获取版本的源代码,然后使用 phpize 将 xmlwriter 编译为模块(如果需要更多帮助,请告诉我)。

如果这不起作用 - 您将需要获取源代码,并从头开始编译所有内容。在这种情况下,configure 是从您将源提取到的文件夹中运行的。

要记住的其他事项 - 您现在安装的任何扩展 - 您需要编译它们,或者使用您获得的源重新构建(除非 php 版本匹配 - 然后您可以使用已经安装的)。

最后,发行版通常带有一些 php 二进制文件(如 CGI、apache 模块、cli)。您还需要确保在您的配置命令中启用了此功能(或您需要的任何部分)。

于 2011-03-08T15:11:53.680 回答
1

只需在您提取源代码的目录(例如,/home/user/php-5.3.5)中运行配置命令,不要包括这两个选项。IE:

./configure -prefix=/usr ... <everything but --disable-xmlreader and --disable-xmlwriter>
于 2011-03-08T15:04:27.783 回答