Browse Source

[php] CakePHP update to PHP 8.5 (#10337)

* [php] CakePHP update to PHP 8.5

* Fix deprecated RFC

* Update error reporting settings for PHP 8.5

* Quiet composer

* Update benchmark_config.json for CakePHP [skip]
Joan Miquel 4 days ago
parent
commit
597b2d0316

+ 2 - 1
frameworks/PHP/cakephp/benchmark_config.json

@@ -43,9 +43,10 @@
             "webserver": "none",
             "webserver": "none",
             "os": "Linux",
             "os": "Linux",
             "database_os": "Linux",
             "database_os": "Linux",
-            "display_name": "CakePHP-workerman",
+            "display_name": "CakePHP [workerman]",
             "notes": "",
             "notes": "",
             "versus": "php"
             "versus": "php"
         }
         }
     }]
     }]
 }
 }
+

+ 7 - 6
frameworks/PHP/cakephp/cakephp-workerman.dockerfile

@@ -7,24 +7,25 @@ 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
     apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null
 
 
 RUN apt-get install -yqq git unzip \
 RUN apt-get install -yqq git unzip \
-    php8.4-cli php8.4-mysql php8.4-mbstring php8.4-intl php8.4-xml php8.4-curl > /dev/null
+    php8.5-cli php8.5-mysql php8.5-mbstring php8.5-intl php8.5-xml php8.5-curl > /dev/null
 
 
 COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
 COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
 
 
-RUN apt-get install -y php-pear php8.4-dev libevent-dev > /dev/null
-RUN pecl install event-3.1.4 > /dev/null && echo "extension=event.so" > /etc/php/8.4/cli/conf.d/event.ini
+RUN apt-get install -y php-pear php8.5-dev libevent-dev > /dev/null
+RUN pecl install event-3.1.4 > /dev/null && echo "extension=event.so" > /etc/php/8.5/cli/conf.d/event.ini
 
 
 EXPOSE 8080
 EXPOSE 8080
 
 
 ADD ./ /cakephp
 ADD ./ /cakephp
 WORKDIR /cakephp
 WORKDIR /cakephp
 
 
-RUN composer require joanhey/adapterman:^0.7
-RUN composer install --optimize-autoloader --classmap-authoritative --no-dev  --quiet
+RUN composer require joanhey/adapterman:^0.7 --quiet
+RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
 
 
 RUN chmod -R 777 /cakephp
 RUN chmod -R 777 /cakephp
 
 
-#COPY deploy/conf/cli-php.ini /etc/php/8.4/cli/php.ini
+#COPY deploy/conf/cli-php.ini /etc/php/8.5/cli/php.ini
 
 
 CMD php -c deploy/conf/cli-php.ini \
 CMD php -c deploy/conf/cli-php.ini \
     server.php start
     server.php start
+

+ 5 - 5
frameworks/PHP/cakephp/cakephp.dockerfile

@@ -7,22 +7,22 @@ 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
     apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null
 
 
 RUN apt-get install -yqq nginx git unzip \
 RUN apt-get install -yqq nginx git unzip \
-    php8.4-fpm php8.4-mysql php8.4-xml php8.4-mbstring php8.4-intl php8.4-dev php8.4-curl > /dev/null
+    php8.5-fpm php8.5-mysql php8.5-xml php8.5-mbstring php8.5-intl php8.5-dev php8.5-curl > /dev/null
 
 
 COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
 COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
 
 
-COPY deploy/conf/* /etc/php/8.4/fpm/
-COPY deploy/conf/* /etc/php/8.4/cli/
+COPY deploy/conf/* /etc/php/8.5/fpm/
+COPY deploy/conf/* /etc/php/8.5/cli/
 
 
 ADD ./ /cakephp
 ADD ./ /cakephp
 WORKDIR /cakephp
 WORKDIR /cakephp
 
 
-RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.4/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.5/fpm/php-fpm.conf ; fi;
 
 
 RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
 RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
 
 
 RUN chmod -R 777 /cakephp 
 RUN chmod -R 777 /cakephp 
 
 
-CMD service php8.4-fpm start && \
+CMD service php8.5-fpm start && \
     nginx -c /cakephp/deploy/nginx.conf
     nginx -c /cakephp/deploy/nginx.conf
 
 

+ 3 - 0
frameworks/PHP/cakephp/deploy/conf/cli-php.ini

@@ -14,3 +14,6 @@ opcache.jit_buffer_size = 128M
 opcache.jit = tracing
 opcache.jit = tracing
 
 
 disable_functions=header,header_remove,headers_sent,headers_list,http_response_code,setcookie,session_create_id,session_id,session_name,session_save_path,session_status,session_start,session_write_close,session_regenerate_id,session_unset,session_get_cookie_params,session_set_cookie_params,set_time_limit
 disable_functions=header,header_remove,headers_sent,headers_list,http_response_code,setcookie,session_create_id,session_id,session_name,session_save_path,session_status,session_start,session_write_close,session_regenerate_id,session_unset,session_get_cookie_params,session_set_cookie_params,set_time_limit
+
+#php 8.5
+error_reporting = E_ALL & ~E_DEPRECATED

+ 3 - 3
frameworks/PHP/cakephp/server.php

@@ -26,7 +26,7 @@ Worker::runAll();
 
 
 class HeaderDate
 class HeaderDate
 {
 {
-    const NAME = 'Date: ';
+    const DATE_FORMAT = 'D, d M Y H:i:s \G\M\T';
 
 
     /**
     /**
      * Date header
      * Date header
@@ -37,9 +37,9 @@ class HeaderDate
 
 
     public static function init(): void
     public static function init(): void
     {
     {
-        self::$date = self::NAME.gmdate(DATE_RFC7231);
+        self::$date = 'Date: '.gmdate(self::DATE_FORMAT);
         Timer::add(1, static function () {
         Timer::add(1, static function () {
-            self::$date = self::NAME.gmdate(DATE_RFC7231);
+            self::$date = 'Date: '.gmdate(self::DATE_FORMAT);
         });
         });
     }
     }
 }
 }