Search code examples
php-7.2phpspreadsheet

PHPSpreadsheet and PHP7.2


I have my LAMP cluster with PHP7.2. I am trying to install PHPSpreadsheet, but I keep coming up with errors.

`
# composer require phpoffice/phpspreadsheet Using version ^1.4 for phpoffice/phpspreadsheet ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

Problem 1
- phpoffice/phpspreadsheet 1.4.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpoffice/phpspreadsheet 1.4.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- Installation request for phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1].

To enable extensions, verify that they are enabled in your .ini files:
- /etc/php.ini
- /etc/php.d/10-opcache.ini
- /etc/php.d/20-bz2.ini
- /etc/php.d/20-calendar.ini
- /etc/php.d/20-ctype.ini
- /etc/php.d/20-curl.ini
- /etc/php.d/20-exif.ini
- /etc/php.d/20-fileinfo.ini
- /etc/php.d/20-ftp.ini
- /etc/php.d/20-gd.ini
- /etc/php.d/20-gettext.ini
- /etc/php.d/20-iconv.ini
- /etc/php.d/20-json.ini
- /etc/php.d/20-mbstring.ini
- /etc/php.d/20-mysqlnd.ini
- /etc/php.d/20-pdo.ini
- /etc/php.d/20-phar.ini
- /etc/php.d/20-sockets.ini
- /etc/php.d/20-sqlite3.ini
- /etc/php.d/20-tokenizer.ini
- /etc/php.d/30-mysqli.ini
- /etc/php.d/30-pdo_mysql.ini
- /etc/php.d/30-pdo_sqlite.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

`

And after googling I have various permutations of installing php-xml, but all I get is

` Dependency Resolution Errors:

Package: php-xmlrpc-5.4.16-45.el7.x86_64 (base)
Requires: php-common(x86-64) = 5.4.16-45.el7
Installed: php-common-7.2.4-1.el7.remi.x86_64 (@remi-php72)
    php-common(x86-64) = 7.2.4-1.el7.remi
Available: php-common-5.4.16-45.el7.x86_64 (base)
    php-common(x86-64) = 5.4.16-45.el7Package: php-xml-5.4.16-45.el7.x86_64 (base)
Requires: php-common(x86-64) = 5.4.16-45.el7
Installed: php-common-7.2.4-1.el7.remi.x86_64 (@remi-php72)
    php-common(x86-64) = 7.2.4-1.el7.remi
Available: php-common-5.4.16-45.el7.x86_64 (base)
    php-common(x86-64) = 5.4.16-45.el7

`

Can anybody help me with getting this installed? I have tried to manually downloading it and copying it to my working directory, but all these namespaces keep looking for a "vendor/autoload" file which I do not have.


Solution

  • You have installed php from remi-php72 which is not enabled, so you got dependency issues when trying to install additional extensions.

    See the Wizard instructions

    So:

    yum install yum-utils
    yum-config-manager --enable remi-php72
    

    And then install needed extension

    yum install php-dom
    

    Notice, having the repository permanently enabled will also give you benefit of the monthly updates, and will avoid to run a outdated not secure version (7.2.4) but instead will give you the latest (7.2.10 for now)