Missing XMLReader in my PHP version?
Pergunta
I'm trying to use the WURFL API for PHP. I'm getting the following error during its initialization.
Fatal error: Class 'XMLReader' not found in /var/www/html/wurfl-api/WURFL/Xml/AbstractIterator.php on line 89
my version of PHP when I run php -v
:
PHP 5.3.3 (cli) (built: Jul 22 2010 16:21:30)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
Why do you think I am getting this error? Is my version of PHP outdated?
Thank you!
Solução
You have no XML extention installed. In RedHat like systems type yum install php53-xml
in terminal. Or you can simply add phpinfo();
to your PHP code to rewiew your server configuration and find wether XML installed or not.
Outras dicas
To install in debian based systems.
sudo apt install php7.2-xml
of course replace the php version with the version you are using.
You can check current used php version with :
php -v
After it is installed you will need to restart apache service if you are using it, or nginx.
sudo service apache2 restart
run php -m
to check if the module is present