Skip to content

Commit ead9bbf

Browse files
author
epriestley
committed
Test for pcntl availability from the command line, not Apache
Summary: In RHEL6 at the least, pcntl installs from distro package management to the CLI but not to Apache. Since we don't need it in apache and it's a pain to build manually, just verify it exists on the CLI. Test Plan: Simulated script failures and verified setup output. Reviewed By: codeblock Reviewers: codeblock, aran, jungejason, tuomaspelkonen CC: aran, epriestley, kevinwallace, codeblock Differential Revision: 380
1 parent 693977f commit ead9bbf

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

scripts/setup/pcntl_available.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
/*
5+
* Copyright 2011 Facebook, Inc.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
if (extension_loaded('pcntl')) {
21+
echo "YES\n";
22+
} else {
23+
echo "NO\n";
24+
}

src/infrastructure/setup/PhabricatorSetup.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public static function runSetup() {
3636
'mysql',
3737
'hash',
3838
'json',
39-
'pcntl',
4039
'openssl',
4140
);
4241
foreach ($extensions as $extension) {
@@ -47,10 +46,32 @@ public static function runSetup() {
4746
return;
4847
}
4948
}
50-
self::write("[OKAY] All extensions OKAY\n\n");
5149

52-
self::writeHeader("GIT SUBMODULES");
5350
$root = dirname(phutil_get_library_root('phabricator'));
51+
52+
// On RHEL6, doing a distro install of pcntl makes it available from the
53+
// CLI binary but not from the Apache module. This isn't entirely
54+
// unreasonable and we don't need it from Apache, so do an explicit test
55+
// for CLI availability.
56+
list($err, $stdout, $stderr) = exec_manual(
57+
'%s/scripts/setup/pcntl_available.php',
58+
$root);
59+
if ($err) {
60+
self::writeFailure();
61+
self::write("Unable to execute scripts/setup/pcntl_available.php.");
62+
return;
63+
} else {
64+
if (trim($stdout) == 'YES') {
65+
self::write(" okay pcntl is available from the command line.\n");
66+
self::write("[OKAY] All extensions OKAY\n\n");
67+
} else {
68+
self::write(" warn pcntl is not available!\n");
69+
self::write("[WARN] *** WARNING *** pcntl extension not available. ".
70+
"You will not be able to run daemons.\n");
71+
}
72+
}
73+
74+
self::writeHeader("GIT SUBMODULES");
5475
if (!Filesystem::pathExists($root.'/.git')) {
5576
self::write(" skip Not a git clone.\n\n");
5677
} else {

0 commit comments

Comments
 (0)