File tree Expand file tree Collapse file tree
DOCUMENTATION/content/documentation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1499,8 +1499,31 @@ e) set it to `true`
149914993 - Set it to ` true `
15001500<br >
150115014 - Re-build the containers ` docker-compose build php-fpm `
1502+ <br >
1503+
1504+
15021505
15031506
1507+ <br >
1508+ <a name =" Install-Faketime " ></a >
1509+ ## Install libfaketime in the php-fpm container
1510+ Libfaketime allows you to control the date and time that is returned from the operating system.
1511+ It can be used by specifying a special string in the ` PHP_FPM_FAKETIME ` variable in the ` .env ` file.
1512+ For example:
1513+ ` PHP_FPM_FAKETIME=-1d `
1514+ will set the clock back 1 day. See (https://github.com/wolfcw/libfaketime ) for more information.
1515+
1516+ 1 - Open the ` .env ` file
1517+ <br >
1518+ 2 - Search for the ` PHP_FPM_INSTALL_FAKETIME ` argument under the PHP-FPM container
1519+ <br >
1520+ 3 - Set it to ` true `
1521+ <br >
1522+ 4 - Search for the ` PHP_FPM_FAKETIME ` argument under the PHP-FPM container
1523+ <br >
1524+ 5 - Set it to the desired string
1525+ <br >
1526+ 6 - Re-build the containers ` docker-compose build php-fpm ` <br >
15041527
15051528
15061529
Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ services:
144144 - INSTALL_IMAGE_OPTIMIZERS=${PHP_FPM_INSTALL_IMAGE_OPTIMIZERS}
145145 - INSTALL_IMAGEMAGICK=${PHP_FPM_INSTALL_IMAGEMAGICK}
146146 - INSTALL_CALENDAR=${PHP_FPM_INSTALL_CALENDAR}
147+ - INSTALL_FAKETIME=${PHP_FPM_INSTALL_FAKETIME}
147148 volumes :
148149 - ./php-fpm/php${PHP_VERSION}.ini:/usr/local/etc/php/php.ini
149150 - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}
@@ -154,6 +155,7 @@ services:
154155 environment :
155156 - PHP_IDE_CONFIG=${PHP_IDE_CONFIG}
156157 - DOCKER_HOST=tcp://docker-in-docker:2375
158+ - FAKETIME=${PHP_FPM_FAKETIME}
157159 depends_on :
158160 - workspace
159161 networks :
Original file line number Diff line number Diff line change @@ -149,6 +149,8 @@ PHP_FPM_INSTALL_SWOOLE=false
149149PHP_FPM_INSTALL_PG_CLIENT=false
150150PHP_FPM_INSTALL_PCNTL=false
151151PHP_FPM_INSTALL_CALENDAR=false
152+ PHP_FPM_INSTALL_FAKETIME=false
153+ PHP_FPM_FAKETIME=-0
152154
153155### PHP_WORKER ############################################
154156
Original file line number Diff line number Diff line change @@ -485,6 +485,18 @@ RUN if [ ${INSTALL_CALENDAR} = true ]; then \
485485 docker-php-ext-install calendar \
486486;fi
487487
488+ # ##########################################################################
489+ # libfaketime:
490+ # ##########################################################################
491+
492+ USER root
493+
494+ ARG INSTALL_FAKETIME=false
495+
496+ RUN if [ ${INSTALL_FAKETIME} = true ]; then \
497+ apt-get install -y libfaketime \
498+ ;fi
499+
488500# ##########################################################################
489501# Check PHP version:
490502# ##########################################################################
@@ -509,6 +521,12 @@ RUN apt-get clean && \
509521
510522RUN usermod -u 1000 www-data
511523
524+ # Adding the faketime library to the preload file needs to be done last
525+ # otherwise it will preload it for all commands that follow in this file
526+ RUN if [ ${INSTALL_FAKETIME} = true ]; then \
527+ echo "/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1" > /etc/ld.so.preload \
528+ ;fi
529+
512530WORKDIR /var/www
513531
514532CMD ["php-fpm" ]
You can’t perform that action at this time.
0 commit comments