log4phpでエラー「Call to undefined function simplexml_load_file」in CentOS
PHP7.0をremiコマンドでインストール済みのCentOSで、log4phpを設置する事になった。
しかし、log4phpのconfig.xmlを読み込むところでエラーが吐かれた。
Fatal error: Uncaught Error: Call to undefined function simplexml_load_file() in log4php/configurators/LoggerConfigurationAdapterXML.php:87
simplexml_load_fileが無いと申しておる。
ならば、xmlを読み込むモノを入れようではないか。
$ yum install php-xml
するとズラズラとログが流れるが、最後にエラーの文字が
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: ftp.riken.jp
* remi-safe: mirror.smartmedia.net.id
Resolving Dependencies
--> Running transaction check
---> Package php-xml.x86_64 0:5.4.16-42.el7 will be installed
--> Processing Dependency: php-common(x86-64) = 5.4.16-42.el7 for package: php-xml-5.4.16-42.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.24)(64bit) for package: php-xml-5.4.16-42.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.22)(64bit) for package: php-xml-5.4.16-42.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: php-xml-5.4.16-42.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.13)(64bit) for package: php-xml-5.4.16-42.el7.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: php-xml-5.4.16-42.el7.x86_64
--> Processing Dependency: libxslt.so.1()(64bit) for package: php-xml-5.4.16-42.el7.x86_64
--> Processing Dependency: libexslt.so.0()(64bit) for package: php-xml-5.4.16-42.el7.x86_64
--> Running transaction check
---> Package libxslt.x86_64 0:1.1.28-5.el7 will be installed
---> Package php-xml.x86_64 0:5.4.16-42.el7 will be installed
--> Processing Dependency: php-common(x86-64) = 5.4.16-42.el7 for package: php-xml-5.4.16-42.el7.x86_64
--> Finished Dependency Resolution
Error: Package: php-xml-5.4.16-42.el7.x86_64 (base)
Requires: php-common(x86-64) = 5.4.16-42.el7
Installed: php-common-7.0.15-1.el7.remi.x86_64 (@remi-php70)
php-common(x86-64) = 7.0.15-1.el7.remi
Available: php-common-5.4.16-42.el7.x86_64 (base)
php-common(x86-64) = 5.4.16-42.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
最後のエラー文を抜粋すると
Error: Package: php-xml-5.4.16-42.el7.x86_64 (base)
Requires: php-common(x86-64) = 5.4.16-42.el7
Installed: php-common-7.0.15-1.el7.remi.x86_64 (@remi-php70)
php-common(x86-64) = 7.0.15-1.el7.remi
Available: php-common-5.4.16-42.el7.x86_64 (base)
php-common(x86-64) = 5.4.16-42.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
なぜか
php-xml-5.4.16-42.el7.x86_64 (base)
という古いバージョンをインストールしようとして
php-common(x86-64) = 5.4.16-42.el7が必要、と出てるが
既に最新の php-common-7.0.15-1.el7.remi.x86_64 (@remi-php70)
が入っている申しておる。
こういう時はオプションを付けて、remiリポジトリに向けると解決するらしい。
$ yum install --enablerepo=remi php-common php-xml
インストールログはないけど、log4phpが動作するようになった。
めでたしめでたし