PHPWord

Install Composer

  1. Go to composer official website (https://getcomposer.org/doc/00-intro.md)
  2. Download installer and rename it to ‘composer-setup.php’
  3. Execute this command line: php composer-setup.php --install-dir=/usr/local/bin
  4. Rename ‘composer.phar’ to ‘composer’ under /usr/local/bin
  5. Execute this command line to test whether it works or not: composer --help

Install PHPWord

  1. Go to PHPWord github website (https://github.com/PHPOffice/PHPWord) to download
  2. Unzip PHPWord code to specific directory and install by this command line: composer install

If there is error reported:

Problem 1
  – The requested PHP extension ext-xml * is missing from your system. Install or enable PHP’s xml extension.
Problem 2
  – phpunit/phpunit 3.7.9 requires ext-dom * -> the requested PHP extension dom is missing from your system.

……

Check installed php modules: php -m

Install DOM php module: sudo apt-get install php-dom

Reading package lists… Done
Building dependency tree       
Reading state information… Done
Package php-dom is a virtual package provided by:
  php7.1-xml 7.1.2-3+deb.sury.org~xenial+1
  php7.0-xml 7.0.16-3+deb.sury.org~xenial+1
  php5.6-xml 5.6.30-5+deb.sury.org~xenial+2
You should explicitly select one to install.

E: Package ‘php-dom’ has no installation candidate

Select current php version according to phpinfo(); Then execute: sudo apt-get install php7.0-dom

 

Advertisements
Posted in PHP.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s