Skip to content

Commit 78a6ec1

Browse files
committed
New architecture with php8.4, fix #1
1 parent fb6fa36 commit 78a6ec1

14 files changed

Lines changed: 302 additions & 133 deletions

.docker/Dockerfile

Lines changed: 0 additions & 16 deletions
This file was deleted.

.docker/apache_default.conf

Lines changed: 0 additions & 37 deletions
This file was deleted.

.docker/apachephp/97-memcached.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
session.save_handler = memcached
2+
session.save_path = "127.0.0.1:11211"
3+
4+
memcached.sess_locking = 1
5+
memcached.sess_lock_wait_min = 1000
6+
memcached.sess_lock_wait_max = 100000
7+
memcached.sess_lock_retries = 3000

.docker/apachephp/98-xdebug.ini

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
xdebug.mode=debug,develop
2+
xdebug.client_host=host.docker.internal
3+
xdebug.client_port=9003
4+
5+
xdebug.start_with_request=yes
6+
7+
xdebug.var_display_max_depth=5
8+
xdebug.var_display_max_children=256
9+
xdebug.var_display_max_data=1024
10+
11+
xdebug.log_level=0
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
date.timezone = "Europe/Paris"
2+
memory_limit = 512M
3+
max_execution_time = 30
4+
upload_max_filesize = 512M
5+
post_max_size = 512M
6+
expose_php = Off
7+
log_errors = On
8+
log_errors_max_len = 0
9+
max_input_vars = 10000
10+
11+
; Log on file or Docker
12+
; error_log = /var/log/php-error.log
13+
error_log = /dev/stderr
14+
15+
; Development
16+
display_errors = On
17+
error_reporting = E_ALL
18+
opcache.enable = Off
19+
session.save_handler = files
20+
session.save_path = "/tmp"
21+
22+
; Production
23+
; display_errors = Off
24+
; error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED & ~E_STRICT
25+
; opcache.enable = On
26+
; opcache.validate_timestamps = Off
27+
; opcache.memory_consumption = 32

.docker/apachephp/Dockerfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM php:8.4-apache
2+
LABEL maintainer="J.GAUTHI <github.com/jgauthi>"
3+
4+
ENV \
5+
DEBIAN_FRONTEND=noninteractive \
6+
LANG=fr_FR.UTF-8 \
7+
LANGUAGE=fr_FR.UTF-8 \
8+
LC_ALL=fr_FR.UTF-8 \
9+
TZ=Europe/Paris \
10+
USER_NAME=localuser \
11+
USER_APACHE=www-data \
12+
WORKDIR=/var/www/project/demo
13+
14+
# Installation des outils, configuration du fuseau horaire ET des locales
15+
RUN apt-get update && apt-get install -y --no-install-recommends \
16+
nano curl locales apt-utils supervisor tzdata \
17+
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && echo "${LANG} UTF-8" >> /etc/locale.gen && locale-gen \
18+
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
19+
&& echo "${TZ}" > /etc/timezone \
20+
&& dpkg-reconfigure -f noninteractive tzdata \
21+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
22+
23+
# Extensions PHP: https://github.com/mlocati/docker-php-extension-installer
24+
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
25+
RUN install-php-extensions \
26+
apcu \
27+
amqp \
28+
@composer \
29+
gd \
30+
intl \
31+
memcached \
32+
mysqli pdo_mysql \
33+
mbstring \
34+
opcache \
35+
openssl \
36+
soap \
37+
tidy \
38+
xdebug \
39+
zip
40+
41+
# Install symfony cli: Uncomment to install
42+
# RUN curl -sS https://get.symfony.com/cli/installer | bash && mv /root/.symfony5/bin/symfony /usr/local/bin/
43+
44+
# Apache conf
45+
RUN a2enmod rewrite headers
46+
47+
# Current User usage docker + Apache Group
48+
RUN useradd -u 1000 -g ${USER_APACHE} -m -s /bin/bash ${USER_NAME} || true \
49+
&& chown -R ${USER_NAME}:${USER_APACHE} /var/www \
50+
&& chmod -R 775 /var/www \
51+
&& sed -i 's/\${APACHE_RUN_USER:=www-data}/\${APACHE_RUN_USER:=${USER_NAME}}/' /etc/apache2/envvars
52+
53+
WORKDIR ${WORKDIR}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<VirtualHost *:80>
2+
ServerName demo.localhost
3+
ServerAdmin demo@localhost
4+
5+
DirectoryIndex index.php
6+
DocumentRoot /var/www/project/demo/public
7+
8+
<Directory /var/www/project/demo/public>
9+
Options Indexes FollowSymLinks MultiViews
10+
AllowOverride All
11+
Require all granted
12+
</Directory>
13+
14+
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
15+
16+
# Configuration PHP
17+
<FilesMatch \.php$>
18+
SetHandler application/x-httpd-php
19+
</FilesMatch>
20+
21+
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn, error, crit, alert, emerg.
22+
# It is also possible to configure the loglevel for particular modules, e.g.
23+
# LogLevel info ssl:warn
24+
25+
# Apache logs on docker standard output
26+
ErrorLog /dev/stdout
27+
CustomLog /dev/stdout combined
28+
29+
# Alternatively, you can use other log format like below
30+
# ErrorLog "|/usr/bin/rotatelogs /var/www/project/demo/var/log/apache-error-%Y-%m-%d.log 86400"
31+
# CustomLog "|/usr/bin/rotatelogs /var/www/project/demo/var/log/apache-access-%Y-%m-%d.log 86400" combined
32+
</VirtualHost>
33+
34+
# Remove useless notice message
35+
ServerName localhost
36+
37+
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

.docker/apachephp/app.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
services:
2+
app:
3+
build: .
4+
ports:
5+
- "8000:80"
6+
volumes:
7+
- ../../demo:/var/www/project/demo
8+
# - ./97-memcached.ini:${PHP_INI_DIR}/97-memcached.ini
9+
- ./98-xdebug.ini:${PHP_INI_DIR}/98-xdebug.ini
10+
- ./99-custom-php-conf.ini:${PHP_INI_DIR}/99-custom-php-conf.ini
11+
- ./apache_default.conf:${APACHE_CONF_DIR}/000-default.conf

.editorconfig

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,34 @@ trim_trailing_whitespace = true
1010
indent_style = space
1111
indent_size = 4
1212

13+
[*.{js,jsx,ts,tsx}]
14+
indent_size = 2
15+
16+
[*.{json,lock}]
17+
indent_size = 2
18+
19+
[*.{css,scss}]
20+
indent_size = 2
21+
22+
[*.sh]
23+
indent_style = tab
24+
tab_width = 4
25+
1326
[*.md]
1427
indent_style = tab
15-
indent_size = 4
1628
trim_trailing_whitespace = false
29+
tab_width = 4
30+
31+
[*.{yml,yaml}]
32+
indent_size = 2
33+
34+
[*.xml]
35+
indent_style = tab
36+
tab_width = 4
37+
38+
[{Makefile.*,makefile,Makefile,GNUmakefile,*.mk}]
39+
indent_style = tab
40+
tab_width = 4
1741

1842
[COMMIT_EDITMSG]
1943
max_line_length = 0

.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Environment variables for Docker Compose
2+
COMPOSE_PROJECT_NAME=poc_docker_apache_php
3+
COMPOSE_PATH_SEPARATOR=,
4+
COMPOSE_FILE=.docker/apachephp/app.yml
5+
PHP_INI_DIR=/usr/local/etc/php/conf.d
6+
APACHE_CONF_DIR=/etc/apache2/sites-available

0 commit comments

Comments
 (0)