From 6ba215e290402e8670569365c4bab83ff2e9a7da Mon Sep 17 00:00:00 2001 From: Joan Miquel Date: Mon, 13 Mar 2023 21:21:28 +0100 Subject: [PATCH] [php] Lumen update to Adapterman 0.6 and PHP 8.2 (#8022) * Lumen update to Adapterman 0.6 * Lumen update to PHP 8.2 --- frameworks/PHP/lumen/deploy/conf/cli-php.ini | 2 +- frameworks/PHP/lumen/lumen-laravel-s.dockerfile | 2 +- frameworks/PHP/lumen/lumen-swoole.dockerfile | 2 +- frameworks/PHP/lumen/lumen-workerman.dockerfile | 8 ++++---- frameworks/PHP/lumen/lumen.dockerfile | 8 ++++---- frameworks/PHP/lumen/server-man.php | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/frameworks/PHP/lumen/deploy/conf/cli-php.ini b/frameworks/PHP/lumen/deploy/conf/cli-php.ini index f0aed6b05af..bcccffbc63b 100644 --- a/frameworks/PHP/lumen/deploy/conf/cli-php.ini +++ b/frameworks/PHP/lumen/deploy/conf/cli-php.ini @@ -13,4 +13,4 @@ memory_limit = 512M opcache.jit_buffer_size = 128M opcache.jit = tracing -disable_functions=header,header_remove,http_response_code,setcookie,session_create_id,session_id,session_name,session_save_path,session_status,session_start,session_write_close,session_regenerate_id,set_time_limit \ No newline at end of file +disable_functions=header,header_remove,headers_sent,http_response_code,setcookie,session_create_id,session_id,session_name,session_save_path,session_status,session_start,session_write_close,session_regenerate_id,set_time_limit diff --git a/frameworks/PHP/lumen/lumen-laravel-s.dockerfile b/frameworks/PHP/lumen/lumen-laravel-s.dockerfile index 5940d3e1fd4..814556e4f79 100644 --- a/frameworks/PHP/lumen/lumen-laravel-s.dockerfile +++ b/frameworks/PHP/lumen/lumen-laravel-s.dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1-cli +FROM php:8.2-cli RUN pecl install swoole > /dev/null && \ docker-php-ext-enable swoole diff --git a/frameworks/PHP/lumen/lumen-swoole.dockerfile b/frameworks/PHP/lumen/lumen-swoole.dockerfile index ce159f082e1..abf5e8b0815 100644 --- a/frameworks/PHP/lumen/lumen-swoole.dockerfile +++ b/frameworks/PHP/lumen/lumen-swoole.dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1-cli +FROM php:8.2-cli RUN pecl install swoole > /dev/null && \ docker-php-ext-enable swoole diff --git a/frameworks/PHP/lumen/lumen-workerman.dockerfile b/frameworks/PHP/lumen/lumen-workerman.dockerfile index 0c5adfc9a25..721dbb2e32b 100644 --- a/frameworks/PHP/lumen/lumen-workerman.dockerfile +++ b/frameworks/PHP/lumen/lumen-workerman.dockerfile @@ -7,18 +7,18 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \ apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null RUN apt-get install -yqq nginx git unzip \ - php8.1-cli php8.1-mysql php8.1-mbstring php8.1-xml php8.1-dev > /dev/null + php8.2-cli php8.2-mysql php8.2-mbstring php8.2-xml php8.2-dev > /dev/null COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer -RUN apt-get install -y php-pear php8.1-dev libevent-dev > /dev/null -RUN pecl install event-3.0.8 > /dev/null && echo "extension=event.so" > /etc/php/8.1/cli/conf.d/event.ini +RUN apt-get install -y php-pear php8.2-dev libevent-dev > /dev/null +RUN pecl install event-3.0.8 > /dev/null && echo "extension=event.so" > /etc/php/8.2/cli/conf.d/event.ini ADD ./ /lumen WORKDIR /lumen RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet -RUN composer require joanhey/adapterman --quiet +RUN composer require joanhey/adapterman:^0.6 --quiet RUN mkdir -p /lumen/storage RUN mkdir -p /lumen/storage/framework/sessions diff --git a/frameworks/PHP/lumen/lumen.dockerfile b/frameworks/PHP/lumen/lumen.dockerfile index 0e93a175082..c8bbe761a44 100644 --- a/frameworks/PHP/lumen/lumen.dockerfile +++ b/frameworks/PHP/lumen/lumen.dockerfile @@ -7,16 +7,16 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \ apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null RUN apt-get install -yqq nginx git unzip \ - php8.1-cli php8.1-fpm php8.1-mysql php8.1-mbstring php8.1-xml php8.1-dev > /dev/null + php8.2-cli php8.2-fpm php8.2-mysql php8.2-mbstring php8.2-xml php8.2-dev > /dev/null COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer -COPY deploy/conf/* /etc/php/8.1/fpm/ +COPY deploy/conf/* /etc/php/8.2/fpm/ ADD ./ /lumen WORKDIR /lumen -RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.1/fpm/php-fpm.conf ; fi; +RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.2/fpm/php-fpm.conf ; fi; RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet @@ -29,5 +29,5 @@ RUN chmod -R 777 /lumen EXPOSE 8080 -CMD service php8.1-fpm start && \ +CMD service php8.2-fpm start && \ nginx -c /lumen/deploy/nginx.conf diff --git a/frameworks/PHP/lumen/server-man.php b/frameworks/PHP/lumen/server-man.php index 4b37b74b59e..de20d2a3e95 100644 --- a/frameworks/PHP/lumen/server-man.php +++ b/frameworks/PHP/lumen/server-man.php @@ -11,13 +11,13 @@ $http_worker = new Worker('http://0.0.0.0:8080'); $http_worker->count = (int) shell_exec('nproc') * 4; $http_worker->name = 'AdapterMan-Laravel'; -$http_worker->onWorkerStart = function () { +$http_worker->onWorkerStart = static function () { HeaderDate::init(); //init(); require __DIR__.'/start.php'; }; -$http_worker->onMessage = static function ($connection, $request) { +$http_worker->onMessage = static function ($connection) { $connection->send(run()); };