Samstag, 19. Juli 2014

Pitfalls of Server Administration (nginx, php5fpm and curl-module configuration)

There are many pitfalls in within the domain of Server Administration that a not so experienced  Webdeveloper like myself can fall into. Just this week I spent almost two afternoons to debug the following problem:

I wanted to add the mandrill email delivery ibrary into our php webapplication. Mandrill however gave me the following error: "Call to undefined function curl_init() "
So I had to add the curl module to my php application. It takes only 2 minutes via google to find out how to install the module on our server, basically just "sudo apt-get install php5-curl".
But event after installing curl the error still appeared. So using google again I foud out, that I should use phpinfo() to see if curl is actually installed. It wasn't.

After another research I found out, that I had to restart nginx and php5-fpm, so that the newly added module is loaded. I used "server php5-fpm restart", but event then the module wasn't loaded.
It took another research to find out, that installing the curl module created a curl.ini file in the /etc/php5/fpm/conf.d folder and that this file needs to be loaded. Looking at phpinfo I found out that file wasn't loaded.

Not this problem took me several hours, but I finally found out that there is a bug in Ubuntu that leaves idle php5-fpm processes remaining: https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1242376
So I had to:


  1. Manually kill all php5-fpm processes my Ubuntu Server
  2. To be able to restart/reload php5-fpm
  3. So that the newly installed curl module is loaded
  4. So that my php webapplication can use the curl module
  5. So that the mandrill library can use the curl functionality

Keine Kommentare:

Kommentar veröffentlichen