PHP errors not showing up in CloudWatch #1550
-
|
Similar to this issue I have a brand new version of bref installed and I am running the basic 'Welcome' app. I have purposely broken the PHP in an attempt to see the PHP errors in the logs in CloudWatch. Unfortunately no errors appear in CloudWatch. # serverless.yml
service: app-test
provider:
name: aws
region: eu-west-1
plugins:
- ./vendor/bref/bref
functions:
api:
handler: index.php
description: ''
runtime: php-82-fpm
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
events:
- httpApi: '*'
# Exclude files from deployment
package:
patterns:
- '!node_modules/**'
- '!tests/**'# index.php
<?php
xxx_require 'vendor/autoload.php'; // Assuming you have installed the AWS SDK for PHP via Composer
?># composer.json
{
"require": {
"bref/bref": "^2.0"
}
}# sls --version
Framework Core: 3.31.0
Plugin: 6.2.3
SDK: 4.3.2 Log output: ❯ sls logs -f api --stage stage
INIT_START Runtime Version: provided:al2.v17 Runtime Version ARN: arn:aws:lambda:eu-west-1::runtime:f35635a04216ba4e6a0e74d3c2db080d443709a8f3f2e71fedf54a4f8756705d
[29-May-2023 15:46:55] NOTICE: [pool default] 'user' directive is ignored when FPM is not running as root
[29-May-2023 15:46:55] NOTICE: fpm is running, pid 10
[29-May-2023 15:46:55] NOTICE: ready to handle connections
START
END Duration: 10.81 ms (init: 303.41 ms) Memory Used: 69 MB |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
By default PHP running in PHP FPM does not log anything to stderr. This is the same behavior on any hosting server. Your options are:
|
Beta Was this translation helpful? Give feedback.
-
|
@pbayly-kax trying to reproduce what you're doing here. I dropped a php.ini file in the project root like this ; php/conf.d/php.ini but not luck. Something else i need to do? |
Beta Was this translation helpful? Give feedback.
Thanks @mnapoli
I just enabled logs in the php.ini and now they are writing correctly to cloudwatch logs.