Browse Source

[laravel] Update to PHP 8 (#6181)

Joan Miquel 4 years ago
parent
commit
3f6e0cad7a

+ 1 - 2
frameworks/PHP/laravel/composer.json

@@ -8,8 +8,7 @@
     ],
     ],
     "license": "MIT",
     "license": "MIT",
     "require": {
     "require": {
-        "php": "^7.3",
-        "laravel/framework": "^8.0"
+        "laravel/framework": "^8.16"
     },
     },
     "require-dev": {
     "require-dev": {
         "facade/ignition": "^2.3.6",
         "facade/ignition": "^2.3.6",

+ 1 - 1
frameworks/PHP/laravel/deploy/conf/php-fpm.conf

@@ -14,7 +14,7 @@
 ; Pid file
 ; Pid file
 ; Note: the default prefix is /var
 ; Note: the default prefix is /var
 ; Default Value: none
 ; Default Value: none
-pid = /run/php/php7.3-fpm.pid
+pid = /run/php/php-fpm.pid
 
 
 ; Error log file
 ; Error log file
 ; If it's set to "syslog", log is sent to syslogd instead of being written
 ; If it's set to "syslog", log is sent to syslogd instead of being written

+ 1 - 0
frameworks/PHP/laravel/deploy/nginx.conf

@@ -2,6 +2,7 @@ user www-data;
 worker_processes  auto;
 worker_processes  auto;
 error_log stderr error;
 error_log stderr error;
 worker_rlimit_nofile 200000;
 worker_rlimit_nofile 200000;
+daemon off;
 
 
 events {
 events {
     worker_connections 16384;
     worker_connections 16384;

+ 7 - 7
frameworks/PHP/laravel/laravel.dockerfile

@@ -1,21 +1,21 @@
-FROM ubuntu:20.04
+FROM ubuntu:20.10
 
 
 ARG DEBIAN_FRONTEND=noninteractive
 ARG DEBIAN_FRONTEND=noninteractive
 
 
 RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
 RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
 RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 RUN apt-get update -yqq > /dev/null && \
 RUN apt-get update -yqq > /dev/null && \
-    apt-get install -yqq nginx git unzip php7.4 php7.4-common php7.4-cli php7.4-fpm php7.4-mysql  > /dev/null
-RUN apt-get install -yqq php7.4-mbstring php7.4-xml  > /dev/null
+    apt-get install -yqq nginx git unzip php8.0 php8.0-common php8.0-cli php8.0-fpm php8.0-mysql  > /dev/null
+RUN apt-get install -yqq php8.0-mbstring php8.0-xml  > /dev/null
 
 
 RUN apt-get install -yqq composer > /dev/null
 RUN apt-get install -yqq composer > /dev/null
 
 
-COPY deploy/conf/* /etc/php/7.4/fpm/
+COPY deploy/conf/* /etc/php/8.0/fpm/
 
 
 ADD ./ /laravel
 ADD ./ /laravel
 WORKDIR /laravel
 WORKDIR /laravel
 
 
-RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/7.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.0/fpm/php-fpm.conf ; fi;
 
 
 RUN mkdir -p /laravel/bootstrap/cache
 RUN mkdir -p /laravel/bootstrap/cache
 RUN mkdir -p /laravel/storage/framework/sessions
 RUN mkdir -p /laravel/storage/framework/sessions
@@ -30,5 +30,5 @@ RUN php artisan optimize
 
 
 RUN chmod -R 777 /laravel
 RUN chmod -R 777 /laravel
 
 
-CMD service php7.4-fpm start && \
-    nginx -c /laravel/deploy/nginx.conf -g "daemon off;"
+CMD service php8.0-fpm start && \
+    nginx -c /laravel/deploy/nginx.conf