One of the components in a web application solution we’re developing uses xmlrpc_encode_request() in PHP.
It was executing fine in most of our systems systems – development and multiple test servers – but while trying to run it for the first time in my development environment I received the following error:
Fatal error: Uncaught Error: Call to undefined function xmlrpc_encode_request()
So off to Google I go and, find a few answers, have a couple of mis-starts, then finally get it working.
The solution was very simple.
- Install the xmlrpc extension.sudo apt-get install php-xmlrpc
- Restart Apache web serversudo service apache2 restart
As a sanity check, create a PHP file (e.g. info.php) and add the following:
<?php echo 'XMLRPC is ', extension_loaded('xmlrpc') ? 'loaded' : 'not loaded'; ?>
When you run the file it you should see “XMLRPC is loaded” if all is good.
If you’re still having trouble, try updating your php.ini file to include:
Unfortunately, if you still have trouble then I apologise and suggest hitting Google/Bing/DuckDuckGo/StackOverflow again and playing around with search terms that meet your specific Linux/OS/PHP versions.
I started with a search for “Fatal error: Uncaught Error: Call to undefined function xmlrpc_encode_request” then “lamp Fatal error: Uncaught Error: Call to undefined function xmlrpc_encode_request”, and had these results:
But they were aimed at PHP 5.x (by the way, if you’re still on PHP 5.x then update! It’s no longer supported and you’re now a security risk).
Then I refined my search to “apt-get php 7.2 xmlrpc” and had:
And I found the helpful suggestion for the info PHP file (you could also just run phpinfo(); in a file) at: