You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following command will expose the current working directory on port 8080:
38
39
```bash
39
40
$ docker run --name web0 -p 8080:80 -v $PWD:/var/www/html moodlehq/moodle-php-apache:8.3
40
41
```
41
42
42
43
## Features
44
+
43
45
* Preconfigured with all php extensions required for Moodle development and all database drivers
44
-
* Serves wwwroot configured at /var/www/html/
46
+
* Serves content from `/var/www/html` or `/var/www/html/public` (for Moodle 5.1 onwards) by default.
47
+
* Document root can be overridden
45
48
* For PHP 7.3 and up, both `linux/amd64` and `linux/arm64` images are being built. Note that `linux/arm64` doesn't support the sqlsrv and oci extensions yet. Other than that, both architectures work exactly the same.
46
49
* Verified by [automated tests](https://travis-ci.com/moodlehq/moodle-php-apache).
47
50
* Autobuilt from GHA, on push.
48
51
* Support for entrypoint scripts and PHP Configuration
49
52
* Many common extensions available
50
53
* Note that PHP 8.4 images do not include oci extensions as these are no longer supported by Moodle 5.0 onwards.
51
54
55
+
## Configuration
56
+
57
+
### Apache Configuration
58
+
59
+
This image makes use of the Apache HTTPD server to serve all content. It requires minimal manual configuration.
60
+
61
+
The Apache `DocumentRoot` directive can be configured using the `APACHE_DOCUMENT_ROOT` environment variable, for example:
62
+
63
+
```bash
64
+
docker run \
65
+
--name web0 \
66
+
-p 8080:80 \
67
+
-v $PWD/moodle:/srv/moodle
68
+
-e APACHE_DOCUMENT_ROOT=/srv/moodle \
69
+
moodle-php-apache:latest
70
+
```
71
+
72
+
Note: Specifying a `DocumentRoot` will override the default root, and will prevent the ability for the image to automatically configure any Moodle-specific configuration.
73
+
74
+
### PHP Configuration
75
+
76
+
As a lightweight alternative to a full PHP configuration file, you can specify a set of prefixed environment variables when starting your container with these variables turned into ini-format configuration.
77
+
78
+
Any environment variable whose name is prefixed with `PHP_INI-` will have the prefix removed, and will be added to a new ini file before the main command starts.
79
+
80
+
```bash
81
+
docker run \
82
+
--name web0 \
83
+
-p 8080:80 \
84
+
-v $PWD/moodle:/var/www/html
85
+
-e PHP_INI-upload_max_filesize=200M \
86
+
-e PHP_INI-post_max_size=210M \
87
+
moodle-php-apache:latest
88
+
```
89
+
90
+
52
91
## Directories
92
+
53
93
To facilitate testing and easy setup the following directories are created and owned by www-data by default:
54
94
55
95
*`/var/www/moodledata`
@@ -59,9 +99,19 @@ To facilitate testing and easy setup the following directories are created and o
59
99
60
100
## Initialisation scripts
61
101
62
-
If you would like to do additional initialization, you can add one or more `*.sh`, or `*.ini` scripts under `/docker-entrypoint.d` (creating the directory if necessary). When the entrypoint script is called, it will run any executable `*.sh` script, source any non-executable `*.sh` scripts found in that directory, and will copy any `*.ini` scripts into the PHP Configuration directory (`/usr/local/etc/php/conf.d`).
102
+
This image supports custom initialisation scripts using the the `docker-entrypoint.d` directory. These may be in the following formats:
103
+
104
+
* a non-executable `.sh` script, which will be _sourced_ and alter the current context;
105
+
* an executable `.sh` script, which will be _executed_ in the current context;
106
+
* a `.ini` file. which will be copied into the PHP Configuration directory (`/usr/local/etc/php/conf.d`.)
63
107
64
-
For example, to configure PHP to support a higher `upload_max_filesize` option you might add the following to a `config/10-uploads.ini` file:
108
+
The following scripts are included as standard:
109
+
110
+
*`10-wwwroot.sh` - a non-executable script used to guess the `APACHE_DOCUMENT_ROOT` if one is not provided.
111
+
112
+
These scripts cannot be removed, but may be disabled by creating a file with a matching file name in your own `docker-entrypoint.d` location.
113
+
114
+
Other scripts may also be provided, for example, to configure PHP to support a higher `upload_max_filesize` option you might add the following to a `config/10-uploads.ini` file:
65
115
66
116
```
67
117
; Specify a max filesize of 200M for uploads.
@@ -82,22 +132,6 @@ docker run \
82
132
83
133
These initialization files will be executed in sorted name order as defined by the current locale, which defaults to en_US.utf8.
84
134
85
-
## PHP Configuration
86
-
87
-
As a lightweight alternative to a full PHP configuration file, you can specify a set of prefixed environment variables when starting your container with these variables turned into ini-format configuration.
88
-
89
-
Any environment variable whose name is prefixed with `PHP_INI-` will have the prefix removed, and will be added to a new ini file before the main command starts.
90
-
91
-
```
92
-
docker run \
93
-
--name web0 \
94
-
-p 8080:80 \
95
-
-v $PWD/moodle:/var/www/html
96
-
-e PHP_INI-upload_max_filesize=200M \
97
-
-e PHP_INI-post_max_size=210M \
98
-
moodle-php-apache:latest
99
-
```
100
-
101
135
## Extensions
102
136
103
137
The following extensions are included as standard:
0 commit comments