Skip to content

Commit

Permalink
[php] Lumen update to Adapterman 0.6 and PHP 8.2 (#8022)
Browse files Browse the repository at this point in the history
* Lumen update to Adapterman 0.6

* Lumen update to PHP 8.2
  • Loading branch information
joanhey authored Mar 13, 2023
1 parent 41472c5 commit 6ba215e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion frameworks/PHP/lumen/deploy/conf/cli-php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
2 changes: 1 addition & 1 deletion frameworks/PHP/lumen/lumen-laravel-s.dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion frameworks/PHP/lumen/lumen-swoole.dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions frameworks/PHP/lumen/lumen-workerman.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions frameworks/PHP/lumen/lumen.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
4 changes: 2 additions & 2 deletions frameworks/PHP/lumen/server-man.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
};
Expand Down

0 comments on commit 6ba215e

Please sign in to comment.