26

I've got a message that ext/xmlwriter is missing while trying to set up phpMyFAQ on my system of Fedora 15. I looked it up on the PHP manual and got this:

This extension is enabled by default. It may be disabled by using the following option at compile time: --disable-xmlwriter

I used yum to install PHP on my computer and consider recompiling PHP quite an unpleasant work. Can I just enable it by editing something, like php.ini? Or any other ways to accomplish this task without recompiling PHP? And how?

lastland
  • 890
  • 3
  • 14
  • 28
  • 1
    Using `phpinfo()` or `php -i` on the commandline you should be able to see what the compile time options were for your PHP build. Can you see if there's any mention of `xmlwriter` there? – James C Jun 17 '11 at 11:21
  • 1
    Yes. And `--disable-xmlwriter` is indeed in the configure command. – lastland Jun 17 '11 at 11:27
  • 1
    It can probably be built (and thus loaded via php.ini) as separate .so module. Else (strongly discouraged) eventually be installed via [`pecl install xmlwriter`](http://pecl.php.net/package/xmlwriter). – mario Jun 17 '11 at 12:02
  • 1
    I just noticed the PHP manual saying that `This extension has no configuration directives defined in php.ini.` Does this mean that there's no possibility to enable it by `php.ini`? – lastland Jun 17 '11 at 12:09
  • 9
    Try `yum install php-xmlwriter` or `yum install php-xml`. – netcoder Jun 17 '11 at 12:57
  • I'd seen php-xml in yum before, but didn't think it would work... until now. `yum install php-xml` and editing `php.ini` make this really work! – lastland Jun 17 '11 at 13:18

4 Answers4

29

on Ubuntu as root

apt install php-xmlwriter

worked for me

else

sudo apt install php-xmlwriter
Babak Bandpey
  • 900
  • 1
  • 12
  • 20
20

In the context of modern PHP, since PHP 7, works the following library to solve this problem - php7.3-xml as an example for PHP 7.3. Works also for another version, change only for your PHP version.

Install for Ubuntu system is like: sudo apt-get install php7.3-xml

If you will install without the version knowledge, install it via sudo apt-get install php-xml.

bueltge
  • 2,294
  • 1
  • 29
  • 40
18

Running the following as recommended by netcoder worked for me

yum install php-xmlwriter

Baxny
  • 576
  • 7
  • 12
5

I had same problem while moving to new server:

1) Check that libxml installed:

php -i | grep "xml"


Result example:

1   /etc/php.d/xmlreader.ini,
2   /etc/php.d/xmlwriter.ini,
3   xmlrpc_error_number => 0 => 0
4   xmlrpc_errors => Off => Off
5   libxml
6   mbstring.http_output_conv_mimetypes => ^(text/|applicatio...
7   Simplexml support => enabled
8   xml
9   libxml2 Version => 2.7.6
10  xmlwriter

Lines 5, 9 & 10 told us that all ok.

2) If not installed (example for CentOS):

yum install libxml2

and restart server:

/etc/apache2 restart

or php-fpm:

/etc/php-fpm restart

maybe will useful next variants:

yum install php-xmlwriter
yum install php-xml

For php from sources in latest versions xmlwriter enabled by default, but you can check, that key --disable-xmlwriter not set.

3) Last step - file:

/etc/php.d/xmlwriter.ini

Needing to be look like:

; Enable xmlwriter extension module
extension=xmlwriter.so

I think latest string - it's main decition for the problem.

eli
  • 61
  • 1
  • 2