2017-03-29 62 views
1

當我檢查我的phpinfo,它顯示如下,我必須使用simplexml,但獲得;PHP5如何添加simplexml?

"Fatal error: Call to undefined function simplexml_load_file() in..."

消息。

disable-xml' '--disable-simplexml' '--disable-dom' '--disable-libxml' '--disable-xmlreader' '--disable-xmlwriter' '--disable-debug'

我怎樣才能使simplexml的

+0

您正在使用的PHP版本?用'php -v'檢查。 –

+0

我有,PHP 5.4.16 – user6618536

回答

2

安裝:

apt-get install php-xml 

檢查:

php -m | grep xml 

重啓:

service php5-fpm restart 
+0

事實上,我已經有這個libray,php -m | grep的XML - > 的libxml XML ,不需要安裝,但仍收到「致命錯誤:調用到...未定義功能使用simplexml_load_file()」,我失去了什麼? – user6618536

+0

你能分享'php -m'和'php -v'的結果嗎? –

+0

[PHP模塊] BZ2 日曆 核心 CTYPE 捲曲 日期 EREG EXIF 的FileInfo 濾波器 FTP gettext的 GMP 散列 的iconv JSON 的libxml mhash OpenSSL的 PCNTL PCRE 的Phar readline 反射 sessio ñ shmop 的SimpleXML 插座 SPL 標準 標記者 XML 拉鍊 zlib的 [Zend的模塊] – user6618536

0

必須重新編譯php源代碼並啓用所有相關的XML插件。

像這樣:

./configure --prefix=/usr/local/php --enable-xml --enable-simplexm --enable-libxml //and so on... 
+0

我應該在哪裏運行這個命令?在哪個目錄下? – user6618536

0

運行此命令在Ubuntu。

sudo apt-get install php5.6-xml