Drupal 10, the latest version of the open-source digital experience platform with even more features, is here.In working my way through installing the Debian package on Ubuntu 16.04, I ran into this:
502 Bad Gateway
nginx/1.10.0 (Ubuntu)
Looking at the error log:
2016/07/19 22:12:30 [error] 31806#31806: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 1.2.3.4, server: aegir.dev.example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "aegir.dev.example.com"
So I compared the Aegir configuration with what I have on Ubuntu 12.04, and found that the PHP FPM modes are different.
I tracked it down to these two stanzas in http/Provision/Service/http/nginx.php:
Line 73:
// Check if there is php-fpm listening on unix socket, otherwise use port 9000 to connect
if (provision_file()->exists('/var/run/php5-fpm.sock')->status()) {
$this->server->phpfpm_mode = 'socket';
drush_log(dt('PHP-FPM unix socket mode detected -SAVE- YES socket found @path.', array('@path' => '/var/run/php5-fpm.sock')));
}
else {
$this->server->phpfpm_mode = 'port';
drush_log(dt('PHP-FPM port mode detected -SAVE- NO socket found @path.', array('@path' => '/var/run/php5-fpm.sock')));
}
Line 135:
// Check if there is php-fpm listening on unix socket, otherwise use port 9000 to connect
if (provision_file()->exists('/var/run/php5-fpm.sock')->status()) {
$this->server->phpfpm_mode = 'socket';
drush_log(dt('PHP-FPM unix socket mode detected -VERIFY- YES socket found @path.', array('@path' => '/var/run/php5-fpm.sock')));
}
else {
$this->server->phpfpm_mode = 'port';
drush_log(dt('PHP-FPM port mode detected -VERIFY- NO socket found @path.', array('@path' => '/var/run/php5-fpm.sock')));
}
So it's obvious that the code is only looking for the PHP 5 socket file, not the new PHP 7 one located at /var/run/php/php7.0-fpm.sock. We need to check for this one as well.
In addition, given that the filenames are in there as string literals mutliple times, we should set these up as variables so that they're only set once. Then we can use those variables everywhere they're needed. So we can do something like this:
$socket_path_php5 = '/var/run/php5-fpm.sock';
$socket_path_php7 = '/var/run/php/php7.0-fpm.sock;
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | interdiff-2769587-9-10.txt | 684 bytes | colan |
| #10 | provision-check_for_php7_socket_location-2769587-10.patch | 12.21 KB | colan |
| #9 | provision-check_for_php7_socket_location-2769587-9.patch | 12.22 KB | colan |
| #3 | provision-check_for_php7_socket_location-2769587-3.patch | 4.13 KB | colan |











Comments
Comment #2
colanComment #3
colanHere's a preliminary attempt. I'll get the missing elements included as well, but please review this patch anyway.
Remaining tasks:
The HTTPS support will need to be ported to Aegir HTTPS in Stop assuming PHP is always at version 5 once we finish here.
Comment #4
memtkmcc CreditAttribution: memtkmcc at Omega8.cc commentedLooks good to me, if the standard path to PHP 7 socket is
/var/run/php/php7.0-fpm.sock( I don't know, because in BOA we are using custom paths per Octopus instance and per PHP version). We need this fix in those other files, too.Comment #5
memtkmcc CreditAttribution: memtkmcc at Omega8.cc commentedHmm.. I can't test this with BOA, because it is never used in BOA, look:
That said, you can always apply a patch on some test vanilla Aegir instance and re-verify it to see if it works as expected, it works on server verify, not only on install:
1. Apply the patch
2.
su -s /bin/bash aegir -c "drush @hm hosting-task @server_master verify --force"Of course it will NOT work, because currently that line is hardcoded:
fastcgi_pass unix:/var/run/php5-fpm.sock;Well, this means that your patch
is not enough and should be rewrittenneeds to provide more specific values for$phpfpm_mode, so in the template we could use something like:Comment #6
memtkmcc CreditAttribution: memtkmcc at Omega8.cc commentedThe fix will be trivial:
Comment #7
memtkmcc CreditAttribution: memtkmcc at Omega8.cc commentedAt least, it will be simpler that adding
$socket_pathas available variable in the template, so we don't hardcode it there via extra if/else. But, you decide.Comment #8
memtkmcc CreditAttribution: memtkmcc at Omega8.cc commentedIt could be also:
Comment #9
colanAll done. Needs testing.
Comment #10
colanI had to change one thing before I could get it to work. I was using drupal_strtoupper(), but this wasn't being included as we're running under Drush. I made some attempts to include the command file, but wasn't successful. We're dealing with ASCII here so it's no major loss. I simply switched to PHP's strtoupper(), and all was well.
Comment #12
memtkmcc CreditAttribution: memtkmcc at Omega8.cc commentedPerfect!