如何在不重新配置 PHP 的情况下在 PHP 中启用 XMLReader? [英] How to enable XMLReader in PHP without reconfiguring PHP?

查看:41
本文介绍了如何在不重新配置 PHP 的情况下在 PHP 中启用 XMLReader?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 PHP 信息是这样的:

配置命令:'--with-libxml-dir=/usr''--启用-xml''--禁用-xmlreader''--禁用-xmlwriter'

即我的 xmlwriter &xmlreader 在安装过程中没有启用.


<块引用>

 libxml

libXML 支持 活动

libXML 编译版      2.7.8

libXML 加载版本        20708

已启用 libXML 流        />

来自 XMLReader 的 php.net 手册

<块引用>

运行时配置

这个扩展没有在php.ini中定义配置指令.

如何启用 XMLReader?/我是否必须再次使用 --enable-xmlreader 编译我的 PHP?

解决方案

我找到了一个解决方法:

首先为我的系统安装包php-xml:php-xml.x86_64

<块引用>

包装说明:php-xml.x86_64 : 使用 XML 的 PHP 应用程序模块

安装上述包(与您的系统相关)以启用 XMLReader、XMLWriter.

php -i

现在有这个:

'--with-libxml-dir=/usr''--启用-xml''--enable-xmlreader=shared''--enable-xmlwriter=shared'

我也通过创建一个XMLReader对象来测试是否启用了包.
但是,我想我会使用 SimpleXML,因为我必须阅读非常小的 xml 文件 &因为它的内存消耗较低.阅读此处.

My PHP info has this:

Configure Command : '--with-libxml-dir=/usr' 
                    '--enable-xml' 
                    '--disable-xmlreader' 
                    '--disable-xmlwriter' 

i.e. my xmlwriter & xmlreader have not been enabled during installation.


                               libxml 

libXML support                       active

libXML Compiled Version        2.7.8

libXML Loaded Version           20708

libXML streams                       enabled

from php.net manual for XMLReader

Runtime Configuration

This extension has no configuration directives defined in php.ini.

How do I enable XMLReader? / Do I have have to compile my PHP again with --enable-xmlreader?

解决方案

I found a workaround:

First Install the package php-xml for my system: php-xml.x86_64

Package description: php-xml.x86_64 : A module for PHP applications which use XML

Install the above mentioned package(respective to your system) to enable XMLReader, XMLWriter.

php -i

has this now:

'--with-libxml-dir=/usr' 
'--enable-xml' 
'--enable-xmlreader=shared' 
'--enable-xmlwriter=shared'

I have also tested whether the package is enabled by creating an object of XMLReader.
But, I think I will be going with SimpleXML because I have to read very small xml files & because of its lower memory consumption. Read here.

这篇关于如何在不重新配置 PHP 的情况下在 PHP 中启用 XMLReader?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆