How To Enable PHP Curl Ngnix (Good for Social share counters)

Updated: 17 September, 2016 seen 10,109

Today I was eager to install and enable really cool Drupal module for my blog - Social Share Counter, this module looked simple - all I had to do, just download, enable and a little bit tweak around.

From module creator (s)

This module gives the share counts for only Facebook,Twitter and more which has some excellent features in more elegant manner. If you have a website, then you definitely need this module.

Unfortunately, after I successfully installed and enabled this module I noticed that share count is not increasing for my articles (I had one article - with more than 5,000 shares and likes today, it felt lame seeing fat zero, while my default Facebook plugin showed it correctly)

I noticed from recent log messages following notice:

Notice: Use of undefined constant CURLOPT_SSL_VERIFYPEER - assumed 'CURLOPT_SSL_VERIFYPEER' in _social_share_counter_parse() (line 254 of /srv/www/

And I got it - most probably I didn't install php5-curl when did setup last time this server, see complete guide on how to setup LEMP Server Ubuntu 12.04 for serving Drupal on Nginx

Now, the fix is really easy - open your SSH terminal (putty, for example), login and:

sudo apt-get install php5-curl
sudo service nginx restart

if you are on Apache use following command to restart Apache2

sudo service apache2 restart

Nginx users will need to perform one more line of code, restart PHP-FPM

/etc/init.d/php5-fpm restart

That's it! Few simple lines of code and php curl is enabled. 

Speaking about me and those social counters, ahh... thus I was able to enable them and got some counters actually working after enabled php-curl, they never showed anything close to real count. I'm not sure foremost, but I guess service providers like Facebook and Twitter are shutting down (depreciated) their API's and ... I will stick with the default Facebook like and share button for now. See: Facebook share button for Drupal views

Used resources: