我注意到我在开发箱上使用的PHP没有启用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编译的。根据{{3}}上的文档,我看到默认情况下启用了此扩展。如何“撤消”此扩展程序禁用?
我的目标是能够使用PHPExcel类集(http://www.php.net/manual/en/xmlwriter.installation.php),但是因为其中一个类试图扩展XMLWriter类而导致致命错误。
答案 0 :(得分:2)
如果您正在使用其中一个具有二进制包的发行版(如openSUSE),那么您只需要安装php-xmlwriter包作为扩展名。
另一种选择 - 只需获取你的版本的源代码,并使用phpize编译xmlwriter作为模块(如果需要更多帮助,请告诉我)。
如果这不起作用 - 您将需要获取源代码,并从头开始编译所有内容。在这种情况下,configure将从您提取源的文件夹中运行。
要记住的其他事项 - 您现在安装的任何扩展 - 您将需要编译它们,或者使用您获得的源重建(除非php版本匹配 - 然后您可以使用已安装的源)
最后,发行版通常带有一些php的二进制文件(如CGI,apache模块,cli)。您需要确保在配置命令中启用了此(或任何您需要的部分)。
答案 1 :(得分:1)
只需在您解压缩源的目录中运行configure命令(例如/home/user/php-5.3.5),不要包含这两个选项。即:
./configure -prefix=/usr ... <everything but --disable-xmlreader and --disable-xmlwriter>