From 964fe66a96777e6fad80dc77cd2a73d68e1823be Mon Sep 17 00:00:00 2001 From: pchinthapenta Date: Thu, 29 Feb 2024 19:49:36 +0530 Subject: [PATCH] chore: Updated sample application and Dockerfile for docker-php deploy config --- test/deploy/linux/php/docker-templates/Dockerfile | 2 +- test/deploy/linux/php/docker-templates/index.php | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/test/deploy/linux/php/docker-templates/Dockerfile b/test/deploy/linux/php/docker-templates/Dockerfile index a662f619..78d1aaa3 100755 --- a/test/deploy/linux/php/docker-templates/Dockerfile +++ b/test/deploy/linux/php/docker-templates/Dockerfile @@ -1,5 +1,5 @@ FROM php:8.2-cli COPY . /usr/src/myapp WORKDIR /usr/src/myapp -EXPOSE 88 +EXPOSE 80 CMD [ "php", "index.php" ] \ No newline at end of file diff --git a/test/deploy/linux/php/docker-templates/index.php b/test/deploy/linux/php/docker-templates/index.php index 02ed70da..13a3740c 100755 --- a/test/deploy/linux/php/docker-templates/index.php +++ b/test/deploy/linux/php/docker-templates/index.php @@ -5,8 +5,13 @@ // Function to print "Hello, World!" function printHelloWorld() { echo "Hello, World!\n"; - ob_flush(); - flush(); + if (extension_loaded('newrelic')) { // Ensure PHP agent is available + newrelic_background_job(false); + } + if (ob_get_length()) { + ob_flush(); + flush(); + } } // Print "Hello, World!" initially