PHP Error: Calling Undefined Function curl_init() Resolved
When executing a PHP code involving a POST request, you may encounter a fatal error: "Call to undefined function curl_init()." To resolve this issue, we need to install and configure CURL support for PHP.
Installation of CURL for PHP
For Ubuntu systems, use the following command to install CURL:
sudo apt-get install php5-curl
Configure PHP for CURL
If you're using apt-get, PHP configuration is not necessary. However, restarting Apache is required:
sudo /etc/init.d/apache2 restart
Verify CURL Installation
Use phpinfo() to ensure CURL is installed and listed. If not, you may need to ask for assistance with package installation.
Installing Manually
If the above method doesn't work, refer to the PHP CURL documentation for manual installation instructions.
The above is the detailed content of How to Resolve the PHP Error: Call to undefined function curl_init()?. For more information, please follow other related articles on the PHP Chinese website!