Skip to content

Commit 8718809

Browse files
committedMar 13, 2024
feat: transition apache to use php-fpm/fcgi
1 parent 607554e commit 8718809

File tree

9 files changed

+44
-9
lines changed

9 files changed

+44
-9
lines changed
 

‎docker/openemr/7.0.3/Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,27 @@ FROM alpine:3.19
33
#Install dependencies and fix issue in apache
44
RUN apk --no-cache upgrade
55
RUN apk add --no-cache \
6-
apache2 apache2-ssl apache2-utils apache2-proxy git php83 php83-tokenizer php83-ctype php83-session php83-apache2 \
6+
apache2 apache2-ssl apache2-utils apache2-proxy git php83 php83-fpm php83-tokenizer php83-ctype php83-session \
77
php83-json php83-pdo php83-pdo_mysql php83-curl php83-ldap php83-openssl php83-iconv \
88
php83-xml php83-xsl php83-gd php83-zip php83-soap php83-mbstring php83-zlib \
99
php83-mysqli php83-sockets php83-xmlreader php83-redis php83-simplexml php83-xmlwriter php83-phar php83-fileinfo \
10-
php83-sodium php83-calendar php83-intl php83-opcache php83-pecl-apcu php83-fpm \
10+
php83-sodium php83-calendar php83-intl php83-opcache php83-pecl-apcu \
1111
perl mysql-client tar curl imagemagick nodejs npm \
1212
certbot openssl openssl-dev dcron \
1313
rsync shadow ncurses \
1414
&& sed -i 's/^Listen 80$/Listen 0.0.0.0:80/' /etc/apache2/httpd.conf
1515
# Needed to ensure permissions work across shared volumes with openemr, nginx, and php-fpm dockers
1616
RUN usermod -u 1000 apache
1717

18-
#BELOW LINE NEEDED TO SUPPORT PHP8 ON ALPINE 3.13+; SHOULD BE ABLE TO REMOVE THIS IN FUTURE ALPINE VERSIONS
18+
#STEPS TO ENSURE php and php-fpm/fcgi both work, which configure proper user/group for php-fpm and set the alpine Event MPM
19+
# (NOTE this needs to be modified with each new php version in 4 lines below)
1920
RUN cp /usr/bin/php83 /usr/bin/php
21+
RUN cp /usr/sbin/php-fpm83 /usr/sbin/php-fpm
22+
RUN sed -i "s/^user = [^ ]*/user = apache/" /etc/php83/php-fpm.d/www.conf
23+
RUN sed -i "s/^group = [^ ]*/group = apache/" /etc/php83/php-fpm.d/www.conf
24+
RUN sed -i "/^LoadModule mpm_prefork_module modules\/mod_mpm_prefork.so/ s/^/#/" /etc/apache2/httpd.conf
25+
RUN sed -i "/LoadModule mpm_event_module modules\/mod_mpm_event.so/ s/# *//" /etc/apache2/httpd.conf
26+
2027
# Install composer for openemr package building
2128
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
2229

‎docker/openemr/7.0.3/openemr.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ CustomLog "|/usr/sbin/rotatelogs -n 5 ${APACHE_LOG_DIR}/access.log 86400" combin
2525
<Directory /var/www/localhost/htdocs/openemr>
2626
# Only allow these HTTP Methods
2727
AllowMethods GET POST PUT DELETE HEAD OPTIONS
28+
# Default to index.html and index.php (added when transitioned to php-fpm/fcgi)
29+
DirectoryIndex index.html index.php
2830
# No indexes anywhere
2931
Options -Indexes
3032
AllowOverride FileInfo

‎docker/openemr/7.0.3/openemr.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@ echo " > https://opencollective.com/openemr/donate"
452452
echo ""
453453

454454
if [ "$OPERATOR" == "yes" ]; then
455+
echo "Starting php-fpm!"
456+
/usr/sbin/php-fpm
455457
echo "Starting apache!"
456458
/usr/sbin/httpd -D FOREGROUND
457459
else

‎docker/openemr/flex-3.19/Dockerfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ FROM alpine:3.19
33
#Install dependencies and fix issue in apache
44
RUN apk --no-cache upgrade
55
RUN apk add --no-cache \
6-
apache2 apache2-ssl apache2-utils apache2-proxy git php83 php83-tokenizer php83-ctype php83-session php83-apache2 \
6+
apache2 apache2-ssl apache2-utils apache2-proxy git php83 php83-fpm php83-tokenizer php83-ctype php83-session \
77
php83-json php83-pdo php83-pdo_mysql php83-curl php83-ldap php83-openssl php83-iconv \
88
php83-xml php83-xsl php83-gd php83-zip php83-soap php83-mbstring php83-zlib \
99
php83-mysqli php83-sockets php83-xmlreader php83-redis perl php83-simplexml php83-xmlwriter php83-phar php83-fileinfo \
10-
php83-sodium php83-calendar php83-intl php83-opcache php83-pecl-apcu php83-fpm \
10+
php83-sodium php83-calendar php83-intl php83-opcache php83-pecl-apcu \
1111
mysql-client tar curl imagemagick nodejs npm \
1212
certbot openssl git openssl-dev dcron \
1313
rsync shadow jq ncurses \
@@ -18,8 +18,16 @@ RUN apk add --no-cache \
1818
RUN apk add --no-cache \
1919
unzip vim nano bash bash-doc bash-completion tree
2020

21-
#BELOW LINE NEEDED TO SUPPORT PHP8 ON ALPINE 3.13+; SHOULD BE ABLE TO REMOVE THIS IN FUTURE ALPINE VERSIONS
21+
#STEPS TO ENSURE php and php-fpm/fcgi both work, which configure proper user/group for php-fpm and set the alpine Event MPM
22+
# (NOTE this needs to be modified with each new php version in 4 lines below)
2223
RUN cp /usr/bin/php83 /usr/bin/php
24+
RUN cp /usr/sbin/php-fpm83 /usr/sbin/php-fpm
25+
RUN sed -i "s/^user = [^ ]*/user = apache/" /etc/php83/php-fpm.d/www.conf
26+
RUN sed -i "s/^group = [^ ]*/group = apache/" /etc/php83/php-fpm.d/www.conf
27+
RUN sed -i "/^LoadModule mpm_prefork_module modules\/mod_mpm_prefork.so/ s/^/#/" /etc/apache2/httpd.conf
28+
RUN sed -i "/LoadModule mpm_event_module modules\/mod_mpm_event.so/ s/# *//" /etc/apache2/httpd.conf
29+
30+
# Install composer for openemr package building
2331
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
2432

2533
# TODO: Note that flex series 3.14+ needs to keep build-base package in (ie. not apk del it after done) for now

‎docker/openemr/flex-3.19/openemr.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ CustomLog "|/usr/sbin/rotatelogs -n 5 ${APACHE_LOG_DIR}/access.log 86400" combin
2525
<Directory /var/www/localhost/htdocs/openemr>
2626
# Only allow these HTTP Methods
2727
AllowMethods GET POST PUT DELETE HEAD OPTIONS
28+
# Default to index.html and index.php (added when transitioned to php-fpm/fcgi)
29+
DirectoryIndex index.html index.php
2830
# No indexes anywhere
2931
Options -Indexes
3032
AllowOverride FileInfo

‎docker/openemr/flex-3.19/openemr.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ echo " > https://opencollective.com/openemr/donate"
514514
echo ""
515515

516516
if [ "$OPERATOR" == "yes" ]; then
517+
echo "Starting php-fpm!"
518+
/usr/sbin/php-fpm
517519
echo "Starting apache!"
518520
/usr/sbin/httpd -D FOREGROUND
519521
else

‎docker/openemr/flex-edge/Dockerfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ FROM alpine:edge
33
#Install dependencies and fix issue in apache
44
RUN apk --no-cache upgrade
55
RUN apk add --no-cache \
6-
apache2 apache2-ssl apache2-utils apache2-proxy git php83 php83-tokenizer php83-ctype php83-session php83-apache2 \
6+
apache2 apache2-ssl apache2-utils apache2-proxy git php83 php83-fpm php83-tokenizer php83-ctype php83-session \
77
php83-json php83-pdo php83-pdo_mysql php83-curl php83-ldap php83-openssl php83-iconv \
88
php83-xml php83-xsl php83-gd php83-zip php83-soap php83-mbstring php83-zlib \
99
php83-mysqli php83-sockets php83-xmlreader php83-redis perl php83-simplexml php83-xmlwriter php83-phar php83-fileinfo \
10-
php83-sodium php83-calendar php83-intl php83-opcache php83-pecl-apcu php83-fpm \
10+
php83-sodium php83-calendar php83-intl php83-opcache php83-pecl-apcu \
1111
mysql-client tar curl imagemagick nodejs npm \
1212
certbot openssl git openssl-dev dcron \
1313
rsync shadow jq ncurses \
@@ -18,8 +18,16 @@ RUN apk add --no-cache \
1818
RUN apk add --no-cache \
1919
unzip vim nano bash bash-doc bash-completion tree
2020

21-
#BELOW LINE NEEDED TO SUPPORT PHP8 ON ALPINE 3.13+; SHOULD BE ABLE TO REMOVE THIS IN FUTURE ALPINE VERSIONS
21+
#STEPS TO ENSURE php and php-fpm/fcgi both work, which configure proper user/group for php-fpm and set the alpine Event MPM
22+
# (NOTE this needs to be modified with each new php version in 4 lines below)
2223
RUN cp /usr/bin/php83 /usr/bin/php
24+
RUN cp /usr/sbin/php-fpm83 /usr/sbin/php-fpm
25+
RUN sed -i "s/^user = [^ ]*/user = apache/" /etc/php83/php-fpm.d/www.conf
26+
RUN sed -i "s/^group = [^ ]*/group = apache/" /etc/php83/php-fpm.d/www.conf
27+
RUN sed -i "/^LoadModule mpm_prefork_module modules\/mod_mpm_prefork.so/ s/^/#/" /etc/apache2/httpd.conf
28+
RUN sed -i "/LoadModule mpm_event_module modules\/mod_mpm_event.so/ s/# *//" /etc/apache2/httpd.conf
29+
30+
# Install composer for openemr package building
2331
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
2432

2533
# TODO: Note that flex series 3.14+ needs to keep build-base package in (ie. not apk del it after done) for now

‎docker/openemr/flex-edge/openemr.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ CustomLog "|/usr/sbin/rotatelogs -n 5 ${APACHE_LOG_DIR}/access.log 86400" combin
2525
<Directory /var/www/localhost/htdocs/openemr>
2626
# Only allow these HTTP Methods
2727
AllowMethods GET POST PUT DELETE HEAD OPTIONS
28+
# Default to index.html and index.php (added when transitioned to php-fpm/fcgi)
29+
DirectoryIndex index.html index.php
2830
# No indexes anywhere
2931
Options -Indexes
3032
AllowOverride FileInfo

‎docker/openemr/flex-edge/openemr.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ echo " > https://opencollective.com/openemr/donate"
514514
echo ""
515515

516516
if [ "$OPERATOR" == "yes" ]; then
517+
echo "Starting php-fpm!"
518+
/usr/sbin/php-fpm
517519
echo "Starting apache!"
518520
/usr/sbin/httpd -D FOREGROUND
519521
else

0 commit comments

Comments
 (0)