Skip to content

Commit 2074385

Browse files
committed
Adding documentation for FrankenPHP
1 parent 031f862 commit 2074385

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

cookbook/web-server/franken-php.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
Running Franken PHP
2+
===================
3+
4+
To add FrankenPHP to an existing project you can follow these steps: `FrankenPHP Documentation`_.
5+
6+
However after running through those steps you need to modify the setup a slight bit:
7+
1. Installing the correct php extensions
8+
2. Adding a database to the project
9+
3. Removing Sulu's default configuration
10+
11+
The modifications
12+
-----------------
13+
.. note::
14+
Beware these instructions might get out of date if FrankenPHP Documentation changes.
15+
16+
After installing you should have a `Dockerfile` which is the base for all containers.
17+
18+
There should be a section under like this:
19+
.. code-block:: dockerfile
20+
# Base FrankenPHP image
21+
...
22+
RUN set -eux; \
23+
install-php-extensions \
24+
@composer \
25+
apcu \
26+
intl \
27+
opcache \
28+
zip \
29+
;
30+
31+
This is the list of installed extensions. For Sulu you also need: `gd` and `pdo_mysql` or `pdo_postgres`.
32+
33+
Secondly we also need to add a database. We can just do that by adding it to the yaml configuration file `compose.yaml`.
34+
35+
Here is an example configuration for mysql:
36+
37+
.. code-block:: yaml
38+
services:
39+
# ....
40+
database:
41+
# arm compatible mysql docker image
42+
image: mysql/mysql-server:${MYSQL_VERSION:-8.0} # arm and x86/x64 compatible mysql image
43+
command: [ "--max_connections=1000", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_general_ci" ]
44+
environment:
45+
MYSQL_DATABASE: ${MYSQL_DATABASE:-sulu}
46+
# You should definitely change the password in production
47+
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-ChangeMe}
48+
MYSQL_ROOT_HOST: '%'
49+
volumes:
50+
- db-data:/var/lib/mysql
51+
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
52+
# - ./docker/db/data:/var/lib/mysql:rw
53+
54+
After setting up the container you might also want to update the `DATABASE_URL` variable in the php service (by default it assumes postgres). At least note that FrankenPHP and the default Sulu mysql container have different default credentials.
55+
56+
If you have some other modifications in your set up be sure to copy all changes of the `docker-compose*` files to the `compose.yaml` and `compose.override.yaml`.
57+
58+
After all this, the Sulu default configuration is not used anymore and can be removed:
59+
.. code-block:: bash
60+
rm docker-compose.yaml
61+
rm docker-compose.override.yaml
62+
63+
.. _FrankenPHP Documentation: https://github.com/dunglas/symfony-docker/blob/main/docs/existing-project.md#installing-on-an-existing-project

cookbook/web-server/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ these tools.
1414
apache
1515
nginx
1616
built-in
17+
franken-php

0 commit comments

Comments
 (0)