Seeing “Fatal error: Uncaught Error: Call to undefined function curl_exec()” from Wordfence, often right after a migration?
That means your new server’s PHP build does not have a working cURL extension or the curl_exec() function is explicitly disabled. Wordfence uses cURL to talk to its update servers and to fetch firewall rules. When cURL is missing, the firewall bootstrap code crashes.
The fix lives on the server side. You or your host need to enable PHP cURL for the PHP version that runs WordPress. Then Wordfence will work normally again.
Wordfence shows this fatal error after a migration:
Fatal error: Uncaught Error: Call to undefined function curl_exec()
How do I fix this so Wordfence works again?
Short version
Wordfence is calling curl_exec() in its firewall code.
Your new PHP environment does not provide that function. Either the PHP cURL extension is not installed or enabled or curl_exec is disabled in php.ini for security.
You fix this by enabling cURL for the PHP that runs your site or asking your host to do it.
Once cURL is available, Wordfence will stop throwing this fatal error.
If you are not sure, just walk through the steps in order.
If this fatal error is on screen and WordPress will not load, temporarily disable Wordfence so you can work.
Use FTP or your hosting file manager.
wp-content/plugins/ folder.wordfence folder.wordfence-disabled./wp-admin/ in a browser.WordPress will stop loading Wordfence and the fatal error should disappear.
You will re enable Wordfence after cURL is fixed.
A typical message looks like this.
Fatal error: Uncaught Error: Call to undefined function curl_exec()
in wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/http.php on line...
Key points.
wf-waf, the Wordfence firewall code.curl_exec() and could not find that function.This does not mean the Wordfence plugin is corrupted. It means your PHP configuration on this server is missing the cURL extension or the function is disabled.
This often appears right after a migration or PHP upgrade when the new server uses a different php.ini.
If you can reach wp admin, the easiest check is through Wordfence diagnostics.
You might see either:
If cURL is not listed then PHP cannot see it and Wordfence cannot use it.
You can use a small temporary PHP file.
check-curl.php.<?php
if (function_exists('curl_exec')) {
echo 'cURL is enabled.';
} else {
echo 'cURL is NOT enabled.';
}
https://your-site.com/check-curl.php in a browser.If it prints cURL is NOT enabled then the extension is missing or disabled.
Delete this file after testing.
Exactly how you do this depends on your hosting. The core idea is always the same.
You need to enable cURL for the exact PHP version that runs your WordPress site.
Names differ a bit by host. The steps are usually close to this.
Then run the check-curl.php test again or reload the Wordfence diagnostics page. It should now show cURL as enabled.
You or your sysadmin may need to install and enable cURL manually.
Examples for common setups. Adjust for your OS and PHP version.
For Ubuntu or Debian with Apache or Nginx:
sudo apt-get install php-curl
sudo service apache2 restart # or: sudo service php8.2-fpm restart
For CentOS or similar:
sudo yum install php-curl
sudo systemctl restart httpd # or: sudo systemctl restart php-fpm
In php.ini you should see a line like:
extension=curl
Make sure it is not commented out.
After installing and restarting, rerun your check-curl.php script.
If cURL still appears to be missing even after you enable it, check that the correct php.ini is being used. The PHP version for the web server and the one for the command line can be different.
If you cannot change PHP settings yourself, your hosting provider needs to fix this.
Open a ticket with wording like this.
I am getting this fatal error when Wordfence loads:
Fatal error: Uncaught Error: Call to undefined function curl_exec()
in wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/http.php
This is after migrating to your server.
It looks like the PHP cURL extension is not enabled for the PHP version that runs my WordPress site.
Can you please:
1) Enable the PHP cURL extension for my site.
2) Make sure the curl_exec function is not disabled in php.ini.
3) Confirm that WordPress sees cURL as enabled.
Ask them to confirm when cURL is active, then retest Wordfence.
Some hosts disable functions with a configuration line like this in php.ini.
disable_functions = exec,passthru,shell_exec,curl_exec,system
If cURL is installed but curl_exec() appears as undefined or you see a message like “curl_exec has been disabled for security reasons” then this list is the problem.
You or your host need to remove curl_exec from disable_functions for the PHP that runs WordPress.
This usually requires host level access. So mention this in your ticket if you suspect it.
If cURL is installed but curl_exec is disabled in php.ini using disable_functions, please remove curl_exec from that list for my site so Wordfence can run correctly.
After they change it, the web server or PHP FPM must be restarted.
Once cURL is enabled and curl_exec is allowed:
wordfence-disabled back to wordfence.If everything is configured correctly, the fatal error should not return.
If you still see the fatal error after cURL is confirmed as enabled, gather this information.
phpinfo() output.Send this to:
This gives them everything they need to check for an edge case in the Wordfence HTTP layer.
You are in good shape when:
curl_exec() fatal error.check-curl.php test, if you used it, prints that cURL is enabled and you have removed the test file.Hit Continue Chat below and tell me:
I can help you translate that into specific next steps or a clear ticket for your host.
Scroll down to the contact form below. Enter your name, email, and WordPress needs. Atiba will get back to you as soon as possible.
WP Assistant is a free tool created by Atiba Software, a WordPress design and development company located in Nashville, TN. If you need more personalized WordPress assistance let us know, and we’ll get back to you ASAP!