Repository navigation
Add --enable-cli-fpm to link the FPM SAPI into the CLI binary (php --fpm)
#23558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mnapoli
wants to merge
4
commits into
php:master
Choose a base branch
from
mnapoli:php-fpm-single-binary
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+146
−10
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ba18979
Add `--enable-cli-fpm` to link the FPM SAPI into the CLI binary (`php…
mnapoli 26fcf38
Parse FPM options after --fpm instead of accepting it as an FPM option
mnapoli 485296b
Rename do_php_fpm() to fpm_main()
mnapoli d0b3226
Run FPM when the combined binary is invoked under a php-fpm name
mnapoli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| --TEST-- | ||
| php --fpm runs the FPM SAPI | ||
| --SKIPIF-- | ||
| <?php | ||
| include "skipif.inc"; | ||
| $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); | ||
| if (!str_contains((string) shell_exec("$php --fpm -n -v 2>&1"), 'fpm-fcgi')) { | ||
| die("skip PHP was not built with --enable-cli-fpm"); | ||
| } | ||
| ?> | ||
| --FILE-- | ||
| <?php | ||
| $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); | ||
|
|
||
| // As the first argument, --fpm switches to the FPM SAPI. | ||
| preg_match('/^Server API => .*$/m', shell_exec("$php --fpm -n -i"), $m); | ||
| var_dump($m[0]); | ||
|
|
||
| // Anywhere else it is an ordinary argument. | ||
| var_dump(shell_exec("$php -n -r 'echo \$argv[1];' -- --fpm")); | ||
|
|
||
| // Running under a name starting with "php-fpm" also switches to the FPM SAPI. | ||
| $dir = __DIR__ . '/cli_fpm'; | ||
| @mkdir($dir); | ||
| symlink(realpath(getenv('TEST_PHP_EXECUTABLE')), "$dir/php-fpm8"); | ||
| preg_match('/^Server API => .*$/m', shell_exec(escapeshellarg("$dir/php-fpm8") . " -n -i"), $m); | ||
| var_dump($m[0]); | ||
| ?> | ||
| --CLEAN-- | ||
| <?php | ||
| $dir = __DIR__ . '/cli_fpm'; | ||
| @unlink("$dir/php-fpm8"); | ||
| @rmdir($dir); | ||
| ?> | ||
| --EXPECT-- | ||
| string(25) "Server API => FPM/FastCGI" | ||
| string(5) "--fpm" | ||
| string(25) "Server API => FPM/FastCGI" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| PHP_ARG_ENABLE([fpm], | ||
| [for FPM build], | ||
| [AS_HELP_STRING([--enable-fpm], | ||
| [Enable building of the fpm SAPI executable])], | ||
| [no], | ||
| [no]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /* | ||
| +----------------------------------------------------------------------+ | ||
| | Copyright © The PHP Group and Contributors. | | ||
| +----------------------------------------------------------------------+ | ||
| | This source file is subject to the Modified BSD License that is | | ||
| | bundled with this package in the file LICENSE, and is available | | ||
| | through the World Wide Web at <https://www.php.net/license/>. | | ||
| | | | ||
| | SPDX-License-Identifier: BSD-3-Clause | | ||
| +----------------------------------------------------------------------+ | ||
| */ | ||
|
|
||
| #include "php.h" | ||
| #include "fpm/fpm.h" | ||
|
|
||
| int main(int argc, char *argv[]) | ||
| { | ||
| return fpm_main(argc, argv, 1); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you I'm not sure this is a good idea. Does this mean that it will always created shared lib for php-fpm so it will no longer be a single binary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No shared library is built. "SHARED" means shared between two SAPIs, following
PHP_CLI_SHARED_OBJSnaming from #21385. Happy to rename it (e.g.PHP_FPM_COMMON_OBJS) if you find it confusing.