Skip to main content

You are here

  1. Home
  2. Notes about PHP FPM and Backdrop CMS
Illustration with text "Think, before you act".
Tags: 
Backdrop CMS
PHP
PHP FPM
Apache
TL;DR: 

Check your PHP FPM conf in Apache if you have trouble updating Backdrop.

Yesterday I found a solution to Backdrop CMS update problem I'd had for some time. Updating via web interface would fail due to following error:

- Error installing / updating
- File transfer failed, reason //var/www/example.com/modules/[module name] is outside of the /var/www/example.com

After asking about the error in the Backdrop CMS forum and receiving a few unhelpful answers I turned my eye to the Apache and PHP FPM settings instead. The double dash in front of the module path suggested a configuration error but all the other PHP-based sites & services (including Drupal 7) I was running were working just fine.

As these things usually go, this was only small syntax error in apache2.conf file. I had this below directory options:

# use FCGI instead of apache's own
<FilesMatch \.php$>
    # default to newest: PHP 7.3
    SetHandler "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost/"
</FilesMatch>

Could that trailing slash after localhost be the source of problem? So I tried the following:

# use FCGI instead of apache's own
<FilesMatch \.php$>
    # default to newest: PHP 7.3
    # NO TRAILING SLASH AFTER LOCALHOST
    SetHandler "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost"
</FilesMatch>

And guess what? Backdrop updates correctly! 

Bottom line: 

If you are using PHP FPM, make sure you don't have trailing slash after the fcgi://localhost -line. While the configuration in most cases works with the trailing slash, some apps (including Backdrop CMS) can fail in random situations.

Käytössä Backdrop CMS