Call to undefined function curl_init() in FreeBSD
I came across this error when I enabled Ping.fm module on one of my sites and tried to post an update. The reason for the error is CURL for PHP is not installed.
You may verify the problem by looking at /usr/local/etc/php/extensions.ini. Chances are, there is no curl.so library listed there. This is easily fixed:
If you don't have portsupdate utility installed, I suggest you do it now (if you can):
cd /usr/ports/ports-mgmt/portupgrade && sudo make install clean
I already had curl installed, so I used portupgrade to upgrade my curl installation. The -R flag tells portupgrade to rebuild and reinstall dependent packages:
sudo /usr/local/sbin/portupgrade -R curl
If you don't have curl installed yet:
cd /usr/ports/ftp/curl && sudo make install clean
Now, let's install the missing php packages:
cd /usr/ports/lang/php5-extensions/ && sudo make install clean
Make sure you check "curl" when configuration screen pops up!
After the installation is complete, restart your apache:
sudo apachectl graceful
Enjoy!
- Alex Polkhovsky's blog
- Login or register to post comments