fix(examples): replace phpinfo() with hello world in php examples#796
Merged
Conversation
The php and php-zip examples called phpinfo() in index.php, which renders the full PHP environment — including the Lambda-injected AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN — to anyone hitting the public endpoint. Users following the examples as-is would expose their function's temporary execution-role credentials. Replace the phpinfo() call with a plain-text "Hello, World!" response and update the php-zip README verification step accordingly.
vicheey
approved these changes
Jul 14, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The
phpandphp-zipexamples callphpinfo()inapp/public/index.php.phpinfo()renders the full PHP environment, which on Lambda includes the runtime-injected credentialsAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY, andAWS_SESSION_TOKEN.Both examples deploy behind a public API Gateway URL, so a user who follows the example as-is exposes live temporary credentials for their function's execution role to anyone who hits the endpoint.
Change
phpinfo()call with a plain-textHello, World!response in bothexamples/phpandexamples/php-zip.php-zipREADME "Verify it works" step, which told users to expectphpinfo()output, to expectHello, World!.The
require .../vendor/autoload.phpline is kept so the example still demonstrates Composer autoloader wiring.Testing
Neither PHP example is built or functionally tested in CI (
test-imageexcludesphp;test-zipexcludesphp-zip). Thevalidate-templatesjob lints the SAM templates, which are unchanged. The edits are static (anechoplus aContent-Typeheader).