简体   繁体   中英

How to enable xmlwriter after PHP having been compiled?

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?

on Ubuntu as root

apt install php-xmlwriter

worked for me

else

sudo apt install php-xmlwriter

Running the following as recommended by netcoder worked for me

yum install php-xmlwriter

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 .

I had same problem while moving to new server:

1) Check that 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

in latest versions xmlwriter enabled by default, but you can check, that key --disable-xmlwriter not set.最新版本xmlwriter中的 ,默认情况下启用,但您可以检查该键--disable-xmlwriter未设置。

- 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM