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
Copy file name to clipboardExpand all lines: README.md
+53-19Lines changed: 53 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -11,21 +11,61 @@ A Moodle PHP environment configured for Moodle development based on [Official PH
11
11
For a complete list of supported versions, look to the [master README](https://github.com/moodlehq/moodle-php-apache/tree/master).
12
12
13
13
## Example usage
14
+
14
15
The following command will expose the current working directory on port 8080:
15
16
```bash
16
17
$ docker run --name web0 -p 8080:80 -v $PWD:/var/www/html moodlehq/moodle-php-apache:7.1
17
18
```
18
19
19
20
## Features
21
+
20
22
* Preconfigured with all php extensions required for Moodle development and all database drivers
21
-
* Serves wwroot configured at /var/www/html/
23
+
* Serves content from `/var/www/html` or `/var/www/html/public` (for Moodle 5.1 onwards) by default.
24
+
* Document root can be overridden
22
25
* 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.
23
26
* Verified by [automated tests](https://travis-ci.com/moodlehq/moodle-php-apache).
24
27
* Autobuilt from GHA, on push.
25
28
* Support for entrypoint scripts and PHP Configuration
26
29
* Many common extensions available
27
30
31
+
## Configuration
32
+
33
+
### Apache Configuration
34
+
35
+
This image makes use of the Apache HTTPD server to serve all content. It requires minimal manual configuration.
36
+
37
+
The Apache `DocumentRoot` directive can be configured using the `APACHE_DOCUMENT_ROOT` environment variable, for example:
38
+
39
+
```bash
40
+
docker run \
41
+
--name web0 \
42
+
-p 8080:80 \
43
+
-v $PWD/moodle:/srv/moodle
44
+
-e APACHE_DOCUMENT_ROOT=/srv/moodle \
45
+
moodle-php-apache:latest
46
+
```
47
+
48
+
Note: Specifying a `DocumentRoot` will override the default root, and will prevent the ability for the image to automatically configure any Moodle-specific configuration.
49
+
50
+
### PHP Configuration
51
+
52
+
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.
53
+
54
+
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.
55
+
56
+
```bash
57
+
docker run \
58
+
--name web0 \
59
+
-p 8080:80 \
60
+
-v $PWD/moodle:/var/www/html
61
+
-e PHP_INI-upload_max_filesize=200M \
62
+
-e PHP_INI-post_max_size=210M \
63
+
moodle-php-apache:latest
64
+
```
65
+
66
+
28
67
## Directories
68
+
29
69
To facilitate testing and easy setup the following directories are created and owned by www-data by default:
30
70
31
71
*`/var/www/moodledata`
@@ -35,9 +75,19 @@ To facilitate testing and easy setup the following directories are created and o
35
75
36
76
## Initialisation scripts
37
77
38
-
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`).
78
+
This image supports custom initialisation scripts using the the `docker-entrypoint.d` directory. These may be in the following formats:
79
+
80
+
* a non-executable `.sh` script, which will be _sourced_ and alter the current context;
81
+
* an executable `.sh` script, which will be _executed_ in the current context;
82
+
* a `.ini` file. which will be copied into the PHP Configuration directory (`/usr/local/etc/php/conf.d`.)
39
83
40
-
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:
84
+
The following scripts are included as standard:
85
+
86
+
*`10-wwwroot.sh` - a non-executable script used to guess the `APACHE_DOCUMENT_ROOT` if one is not provided.
87
+
88
+
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.
89
+
90
+
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:
41
91
42
92
```
43
93
; Specify a max filesize of 200M for uploads.
@@ -58,22 +108,6 @@ docker run \
58
108
59
109
These initialization files will be executed in sorted name order as defined by the current locale, which defaults to en_US.utf8.
60
110
61
-
## PHP Configuration
62
-
63
-
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.
64
-
65
-
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.
66
-
67
-
```
68
-
docker run \
69
-
--name web0 \
70
-
-p 8080:80 \
71
-
-v $PWD/moodle:/var/www/html
72
-
-e PHP_INI-upload_max_filesize=200M \
73
-
-e PHP_INI-post_max_size=210M \
74
-
moodle-php-apache:latest
75
-
```
76
-
77
111
## Extensions
78
112
79
113
The following extensions are included as standard:
0 commit comments