Skip to content

Instantly share code, notes, and snippets.

@dkarlovi
Created October 15, 2021 10:35
Show Gist options
  • Save dkarlovi/adfb0bf059948e552b8ca2a8ae65055b to your computer and use it in GitHub Desktop.
Save dkarlovi/adfb0bf059948e552b8ca2a8ae65055b to your computer and use it in GitHub Desktop.
Example of using libfaketime with PHP in Docker

Usage

# Dockerfile is in the current folder
$ docker build . -t php-faketime
$ docker run --rm -e FAKETIME=+15d php-faketime php -r"var_dump(date('c'));"
string(25) "2021-10-30T10:34:11+00:00"
FROM php:8.0-alpine
COPY --from=trajano/alpine-libfaketime /faketime.so /lib/faketime.so
ENV LD_PRELOAD=/lib/faketime.so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment