I'm using braintree to accept payments on my website. But when I try to open a view to make a purchase I get this error:
Exception in Braintree.php line 20: The Braintree library requires the xmlwriter extension.
and this is my Braintree.php file:
<?php
/**
* Braintree PHP Library
* Creates class_aliases for old class names replaced by PSR-4 Namespaces
*
* @copyright 2015 Braintree, a division of PayPal, Inc.
*/
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php');
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
throw new Braintree_Exception('PHP version >= 5.4.0 required');
}
function requireDependencies() {
$requiredExtensions = ['xmlwriter', 'openssl', 'dom', 'hash', 'curl'];
foreach ($requiredExtensions AS $ext) {
if (!extension_loaded($ext)) {
throw new Braintree_Exception('The Braintree library requires the ' . $ext . ' extension.');
}
}
}
requireDependencies();
I already checked that xmlwriter and libxml are enabled and installed on my project and everything is settled up. So I don't know what else to do. Any idea of why is this happening?
Any help is very apreciatted :)
First, make sure XMLWriter PHP modules are installed
sudo apt-get update
sudo apt-get install php7.0-xml
php -i | grep "xml"
This should display the line xmlwriter
Check your error log sudo cat /var/log/nginx/error.log
If any errors are failed to open stream
, check that your paths are correct.
Error messages should give you more direction.