craftcms / feed-me

Craft CMS plugin for importing entry data from XML, RSS or ATOM feeds—routine task or on-demand.
Other
289 stars 139 forks source link

Class 'SimpleXMLElement' not found #561

Closed nicbou closed 5 years ago

nicbou commented 5 years ago

Description

I installed the plugin from the plugin store, and ran it against a feed that's a regular WordPress export XML file. When I click "Save & continue", I get a stack trace.

Error: Class 'SimpleXMLElement' not found in /var/www/vendor/cakephp/utility/Xml.php:155
Stack trace:
#0 /var/www/vendor/cakephp/utility/Xml.php(119): Cake\Utility\Xml::_loadXml('<?xml version="...', Array)
#1 /var/www/vendor/craftcms/feed-me/src/datatypes/Xml.php(44): Cake\Utility\Xml::build('<?xml version="...')
#2 /var/www/vendor/craftcms/feed-me/src/services/DataTypes.php(191): verbb\feedme\datatypes\Xml->getFeed('http://nicolasb...', Object(verbb\feedme\models\FeedModel), false)
#3 /var/www/vendor/craftcms/feed-me/src/models/FeedModel.php(77): verbb\feedme\services\DataTypes->getFeedData(Object(verbb\feedme\models\FeedModel), false)
#4 /var/www/vendor/craftcms/feed-me/src/controllers/FeedsController.php(64): verbb\feedme\models\FeedModel->getFeedNodes()
#5 [internal function]: verbb\feedme\controllers\FeedsController->actionElementFeed('1', NULL)
#6 /var/www/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#7 /var/www/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#8 /var/www/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller->runAction('element-feed', Array)
#9 /var/www/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('element-feed', Array)
#10 /var/www/vendor/craftcms/cms/src/web/Application.php(284): yii\base\Module->runAction('feed-me/feeds/e...', Array)
#11 /var/www/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('feed-me/feeds/e...', Array)
#12 /var/www/vendor/craftcms/cms/src/web/Application.php(273): yii\web\Application->handleRequest(Object(craft\web\Request))
#13 /var/www/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#14 /var/www/html/index.php(21): yii\base\Application->run()
#15 {main}

This is the docker machine on which my Craft website runs:

FROM alpine:3.6
MAINTAINER Nicolas Bouliane

ENV PHP_VERSION="7.1.17-r0" \
    APACHE_VERSION="2.4.25-r1" \
    OPENSSL_VERSION="1.0.2k-r0" \
    COMPOSER_VERSION="1.4.2" \
    COMPOSER_CHECKSUM="38bb2a696df65a47f6dfa22907e76c3210731530f51dc70f8e104d8b64e9ff2a40b18ea01f3948664fb7595d0e0c92c18dce1efaed6d1d57f05c28fa76f9966f  composer.phar"

# Install modules and updates
RUN apk update \
    && apk --no-cache --repository http://dl-4.alpinelinux.org/alpine/v3.6/community add \
        apache2-http2 \
        apache2-ssl \
        apache2 \
        freetype \
        freetype-dev \
        git \
        imagemagick \
        imagemagick-dev \
        libjpeg-turbo \
        libjpeg-turbo-dev \
        libpng \
        libpng-dev \
        libwebp-dev \
        libxpm-dev \
        openssl \
        simplexml \
        zlib-dev

RUN apk --no-cache --repository http://dl-4.alpinelinux.org/alpine/v3.6/community add \
        php7=="${PHP_VERSION}" \
        php7-apache2 \
        php7-bcmath \
        php7-bz2 \
        php7-calendar \
        php7-common \
        php7-ctype \
        php7-curl \
        php7-dev=="${PHP_VERSION}" \
        php7-dom \
        php7-fileinfo \
        php7-gd \
        php7-iconv \
        php7-imagick \
        php7-json \
        php7-mbstring \
        php7-mcrypt \
        php7-memcached \
        php7-mysqlnd \
        php7-opcache \
        php7-openssl \
        php7-pdo \
        php7-pdo_mysql \
        php7-pdo_sqlite \
        php7-pear=="${PHP_VERSION}" \
        php7-phar=="${PHP_VERSION}" \
        php7-session \
        php7-sockets \
        php7-xml \
        php7-xmlreader \
        php7-zip

RUN rm /var/cache/apk/* \
    && mkdir /run/apache2

# Fix modules
RUN mv /var/www/modules /etc/apache2/modules
RUN mv /var/www/run /etc/apache2/run
RUN mv /var/www/logs /etc/apache2/logs

# Install composer
RUN apk add --update ca-certificates openssl && update-ca-certificates
RUN wget https://getcomposer.org/download/${COMPOSER_VERSION}/composer.phar \
    && echo "${COMPOSER_CHECKSUM}" > composerchecksum.txt \
    && sha512sum -c composerchecksum.txt \
    && rm composerchecksum.txt \
    && mv composer.phar /usr/bin/composer \
    && chmod +x /usr/bin/composer

# Copy local configs
COPY httpd.conf /etc/apache2/httpd.conf
COPY ssl.conf /etc/apache2/conf.d/ssl.conf
COPY php.ini /etc/php7/php.ini

VOLUME ["/var/www", "/etc/ssl/certs"]

RUN mkdir -p /var/www/images
RUN mkdir -p /var/www/videos

# Export http and https
EXPOSE 80 443

# Run apache in foreground
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND", "-f", "/etc/apache2/httpd.conf"]

Additional info

nicbou commented 5 years ago

I solved in on my end by making sure simplexml was installed (php7-simplexml in Alpine) and restarting Apache. Perhaps this could be added to the installation instructions?

nicbou commented 5 years ago

I got further along the process, and got the following error in the logs (no errors in the UI):

The shell command "mysqldump --defaults-extra-file="/var/www/storage/runtime/temp/my.cnf" --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --single-transaction --no-data --result-file="/var/www/storage/backups/feedme-190620_110852_anqdu3clkt.sql" craft && mysqldump --defaults-extra-file="/var/www/storage/runtime/temp/my.cnf" --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --no-create-info --ignore-table=craft.craft_assetindexdata --ignore-table=craft.craft_assettransformindex --ignore-table=craft.craft_sessions --ignore-table=craft.craft_templatecaches --ignore-table=craft.craft_templatecachequeries --ignore-table=craft.craft_templatecacheelements --ignore-table=craft.craft_cache --ignore-table=craft.craft_templatecachecriteria craft >> "/var/www/storage/backups/feedme-190620_110852_anqdu3clkt.sql"" failed with exit code 127: sh: mysqldump: not found - Connection.php: 614

In Alpine, this is solved by installing the mysql-client package.

brandonkelly commented 5 years ago

Ultimately it is the cakephp/utility package’s responsibility to ensure that the SimpleXML extension is installed, as that is the thing that is actually expecting it. I’ve just opened cakephp/cakephp#13402 to address that.