Skip to content

Commit 9599390

Browse files
joanheyandreasrueb
authored andcommitted
[symfony] Update to PHP 8 (TechEmpower#6386)
* [symfony] Update to PHP 8 * Fix doctrine BC break * Update symfony swoole bundle to 0.9 * Symfony swoole update to php 8
1 parent c471c3d commit 9599390

File tree

9 files changed

+36
-39
lines changed

9 files changed

+36
-39
lines changed

frameworks/PHP/symfony/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ Uses Twig 2.11.
2929
## Infrastructure Software Versions
3030
The tests were run with:
3131

32-
* [Symfony 4.3](https://symfony.com/)
33-
* [PHP Version 7.3](https://www.php.net/) with FPM and OPcache
34-
* [nginx 1.15](https://nginx.org/)
35-
* [MySQL 5.7](https://dev.mysql.com/)
32+
* [Symfony](https://symfony.com/)
33+
* [PHP](https://www.php.net/) with FPM and OPcache
34+
* [nginx ](https://nginx.org/)
35+
* [MySQL](https://dev.mysql.com/)
3636

3737

3838
## Test URLs

frameworks/PHP/symfony/composer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"type": "project",
33
"license": "proprietary",
44
"require": {
5-
"php": "^7.4",
5+
"php": ">=7.4",
66
"ext-ctype": "*",
77
"ext-iconv": "*",
88
"ext-mbstring": "*",
@@ -17,9 +17,6 @@
1717
"minimum-stability": "dev",
1818
"prefer-stable": true,
1919
"config": {
20-
"platform": {
21-
"php": "7.4"
22-
},
2320
"preferred-install": {
2421
"*": "dist"
2522
},

frameworks/PHP/symfony/deploy/conf/php-fpm.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
; Pid file
1515
; Note: the default prefix is /var
1616
; Default Value: none
17-
pid = /run/php/php7.3-fpm.pid
17+
pid = /run/php/php-fpm.pid
1818

1919
; Error log file
2020
; If it's set to "syslog", log is sent to syslogd instead of being written
@@ -161,7 +161,7 @@ group = www-data
161161
; (IPv6 and IPv4-mapped) on a specific port;
162162
; '/path/to/unix/socket' - to listen on a unix socket.
163163
; Note: This value is mandatory.
164-
listen = /run/php/php7.3-fpm.sock
164+
listen = /run/php/php-fpm.sock
165165

166166
; Set listen(2) backlog.
167167
; Default Value: 511 (-1 on FreeBSD and OpenBSD)

frameworks/PHP/symfony/deploy/nginx.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ user www-data;
22
worker_processes auto;
33
error_log stderr error;
44
worker_rlimit_nofile 200000;
5+
daemon off;
56

67
events {
78
worker_connections 16384;
@@ -41,7 +42,7 @@ http {
4142

4243

4344
upstream fastcgi_backend {
44-
server unix:/var/run/php/php7.3-fpm.sock;
45+
server unix:/var/run/php/php-fpm.sock;
4546
keepalive 40;
4647
}
4748

frameworks/PHP/symfony/src/Repository/FortuneRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use App\Entity\Fortune;
66
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
7-
use Doctrine\Common\Persistence\ManagerRegistry;
7+
use Doctrine\Persistence\ManagerRegistry;
88

99
class FortuneRepository extends ServiceEntityRepository
1010
{

frameworks/PHP/symfony/src/Repository/WorldRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use App\Entity\World;
66
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
7-
use Doctrine\Common\Persistence\ManagerRegistry;
7+
use Doctrine\Persistence\ManagerRegistry;
88

99
class WorldRepository extends ServiceEntityRepository
1010
{
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:20.10
22

33
ARG DEBIAN_FRONTEND=noninteractive
44

55
RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
66
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
77
RUN apt-get update -yqq > /dev/null && \
8-
apt-get install -yqq nginx git unzip php7.4 php7.4-common php7.4-cli php7.4-fpm php7.4-mysql > /dev/null
9-
RUN apt-get install -yqq php7.4-mbstring php7.4-xml > /dev/null
8+
apt-get install -yqq nginx git unzip curl \
9+
php8.0-cli php8.0-fpm php8.0-mysql \
10+
php8.0-mbstring php8.0-xml php8.0-curl > /dev/null
1011

11-
RUN apt-get install -yqq composer > /dev/null
12+
RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
1213

13-
COPY deploy/conf/* /etc/php/7.4/fpm/
14-
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;
14+
COPY deploy/conf/* /etc/php/8.0/fpm/
15+
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;
1516

1617
WORKDIR /symfony
1718
ADD ./composer.json /symfony/
@@ -26,9 +27,9 @@ RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-env prod
2627
RUN sed -i '/PDO::ATTR_STATEMENT_CLASS/d' ./vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
2728

2829
RUN php bin/console cache:clear
29-
RUN echo "opcache.preload=/symfony/var/cache/prod/App_KernelProdContainer.preload.php" >> /etc/php/7.4/fpm/php.ini
30+
RUN echo "opcache.preload=/symfony/var/cache/prod/App_KernelProdContainer.preload.php" >> /etc/php/8.0/fpm/php.ini
3031

3132
EXPOSE 8080
3233

33-
CMD service php7.4-fpm start && \
34-
nginx -c /symfony/deploy/nginx.conf -g "daemon off;"
34+
CMD service php8.0-fpm start && \
35+
nginx -c /symfony/deploy/nginx.conf

frameworks/PHP/symfony/symfony-swoole.dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
FROM php:7.4
1+
FROM php:8.0
22

33
RUN pecl install swoole > /dev/null && \
44
docker-php-ext-enable swoole
55

66
RUN pecl install apcu > /dev/null && \
77
docker-php-ext-enable apcu
88

9-
RUN docker-php-ext-install pdo pdo_mysql opcache > /dev/null
10-
119
RUN apt-get update -yqq && \
12-
apt-get install -yqq git unzip
10+
apt-get install -yqq libicu-dev git unzip > /dev/null && \
11+
docker-php-ext-install pdo_mysql opcache intl > /dev/null
1312

1413
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
1514

@@ -19,7 +18,7 @@ ADD ./composer.json /symfony/
1918
RUN mkdir -m 777 -p /symfony/var/cache/swoole /symfony/var/log
2019
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --no-scripts --quiet
2120
ADD . /symfony
22-
RUN COMPOSER_ALLOW_SUPERUSER=1 composer require "k911/swoole-bundle:^0.7.8" --no-scripts --quiet
21+
RUN COMPOSER_ALLOW_SUPERUSER=1 composer require "k911/swoole-bundle:^0.9" --no-scripts --ignore-platform-reqs --quiet
2322
RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-autoload --no-dev --classmap-authoritative
2423
RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-env swoole
2524

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:20.10
22

33
ARG DEBIAN_FRONTEND=noninteractive
44

55
RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
66
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
77
RUN apt-get update -yqq > /dev/null && \
8-
apt-get install -yqq nginx git unzip php7.4 php7.4-common php7.4-cli php7.4-fpm php7.4-mysql > /dev/null
9-
RUN apt-get install -yqq php7.4-mbstring php7.4-xml > /dev/null
8+
apt-get install -yqq nginx git unzip curl \
9+
php8.0-cli php8.0-fpm php8.0-mysql \
10+
php8.0-mbstring php8.0-xml php8.0-curl > /dev/null
1011

11-
RUN apt-get install -yqq composer > /dev/null
12+
RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
1213

13-
COPY deploy/conf/* /etc/php/7.4/fpm/
14-
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;
14+
COPY deploy/conf/* /etc/php/8.0/fpm/
15+
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;
1516

1617
WORKDIR /symfony
1718
ADD ./composer.json /symfony/
1819
RUN mkdir -m 777 -p /symfony/var/cache/{dev,prod} /symfony/var/log
19-
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --no-scripts --quiet
20+
RUN composer install --no-dev --no-scripts
2021
ADD . /symfony
2122
RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-autoload --no-dev --classmap-authoritative
2223
RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-env prod
@@ -26,9 +27,7 @@ RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-env prod
2627
RUN sed -i '/PDO::ATTR_STATEMENT_CLASS/d' ./vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
2728

2829
RUN php bin/console cache:clear
29-
RUN echo "opcache.preload=/symfony/var/cache/prod/App_KernelProdContainer.preload.php" >> /etc/php/7.4/fpm/php.ini
30+
RUN echo "opcache.preload=/symfony/var/cache/prod/App_KernelProdContainer.preload.php" >> /etc/php/8.0/fpm/php.ini
3031

31-
EXPOSE 8080
32-
33-
CMD service php7.4-fpm start && \
34-
nginx -c /symfony/deploy/nginx.conf -g "daemon off;"
32+
CMD service php8.0-fpm start && \
33+
nginx -c /symfony/deploy/nginx.conf

0 commit comments

Comments
 (0)