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
This commit is contained in:
		
							
								
								
									
										24
									
								
								scripts/setup/pcntl_available.php
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										24
									
								
								scripts/setup/pcntl_available.php
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| #!/usr/bin/env php | ||||
| <?php | ||||
|  | ||||
| /* | ||||
|  * Copyright 2011 Facebook, Inc. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  *   http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
|  | ||||
| if (extension_loaded('pcntl')) { | ||||
|   echo "YES\n"; | ||||
| } else { | ||||
|   echo "NO\n"; | ||||
| } | ||||
| @@ -36,7 +36,6 @@ class PhabricatorSetup { | ||||
|       'mysql', | ||||
|       'hash', | ||||
|       'json', | ||||
|       'pcntl', | ||||
|       'openssl', | ||||
|     ); | ||||
|     foreach ($extensions as $extension) { | ||||
| @@ -47,10 +46,32 @@ class PhabricatorSetup { | ||||
|         return; | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     $root = dirname(phutil_get_library_root('phabricator')); | ||||
|  | ||||
|     // On RHEL6, doing a distro install of pcntl makes it available from the | ||||
|     // CLI binary but not from the Apache module. This isn't entirely | ||||
|     // unreasonable and we don't need it from Apache, so do an explicit test | ||||
|     // for CLI availability. | ||||
|     list($err, $stdout, $stderr) = exec_manual( | ||||
|       '%s/scripts/setup/pcntl_available.php', | ||||
|       $root); | ||||
|     if ($err) { | ||||
|       self::writeFailure(); | ||||
|       self::write("Unable to execute scripts/setup/pcntl_available.php."); | ||||
|       return; | ||||
|     } else { | ||||
|       if (trim($stdout) == 'YES') { | ||||
|         self::write(" okay  pcntl is available from the command line.\n"); | ||||
|         self::write("[OKAY] All extensions OKAY\n\n"); | ||||
|       } else { | ||||
|         self::write(" warn  pcntl is not available!\n"); | ||||
|         self::write("[WARN] *** WARNING *** pcntl extension not available. ". | ||||
|                     "You will not be able to run daemons.\n"); | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     self::writeHeader("GIT SUBMODULES"); | ||||
|     $root = dirname(phutil_get_library_root('phabricator')); | ||||
|     if (!Filesystem::pathExists($root.'/.git')) { | ||||
|       self::write(" skip  Not a git clone.\n\n"); | ||||
|     } else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 epriestley
					epriestley