Categories

PHP Fatal error: Call to undefined function curl_init()

I recently set up a development server in a VirtualBox VM running Ubuntu server 11.04. My plan was to move a development database and website to this VM and migrate away from a local XAMPP installation on a Windows box. The only problem is that Apache and PHP were not exactly the same between the two systems. This resulted in some of my scripts not working correctly. More specifically, I was getting the “PHP Fatal error: Call to undefined function curl_init()” error.On my Ubuntu VM.

This likely meant that curl was not installed or enabled on Ubuntu, so here’s what I did:

Run this command from a terminal:

sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

Make sure curl is enabled in your php.ini. This file is usually in “/etc/php5/apache2/php.ini”

If this fails, you may try copying the ‘missing’ file from /usr/lib/gcc/i486-linux-gnu/3.4.6/ and replacing the one distributed with the vmware server console. If you get similar error on libpng12.so.0, the file is placed in /usr/lib. You of course have to have the appropriate packages (gcc-3.4, libpng12) installed.