Free PHP hosting
Run PHP, a language for server-rendered web apps, in an always-on container built from your Dockerfile. Start from the PHP template, deploy with the CLI and add Postgres and storage for $0.
Last updated November 25, 2026
What you can run
Any PHP web app or API that listens on HTTP, including Laravel, Symfony, Slim and plain PHP.
The starter Dockerfile
This is the php template, exactly as ezhst build dockerfile template php prints it.
FROM php:8.3-cli WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends unzip && rm -rf /var/lib/apt/lists/* COPY --from=composer:2 /usr/bin/composer /usr/bin/composer COPY composer.json composer.lock* ./ RUN composer install --no-dev --no-scripts --prefer-dist COPY . . ENV PORT=3000 EXPOSE 3000 CMD ["sh", "-c", "exec php -S 0.0.0.0:$PORT -t public"]
Adapt it to your app
The template installs Composer dependencies and serves the public folder with PHP's built-in server on 0.0.0.0:$PORT. Add extensions with docker-php-ext-install, such as pdo_pgsql for Postgres.
- Listen on
0.0.0.0and thePORTvariable, which is3000. A server bound to localhost never receives traffic. - Your variables are runtime env in the container. If a build command needs them, run it in a
RUNstep that mounts theappenvsecret, as the template does. See build-time environment variables. - Never put secrets in
ARGorENV, because they end up in the image.
<?php echo "Hello from Reverhost";
Deploy it
npx ezhst projects create my-project --link npx ezhst apps create my-app npx ezhst build dockerfile template php --apply npx ezhst env import .env npx ezhst deploy
--apply saves the template to the app. To use an edited copy instead, save it as Dockerfile and run npx ezhst build dockerfile set -f Dockerfile. Read how to write a Dockerfile for Reverhost for the general rules.
Limits
Each app gets 256 MB of RAM with no swap, 0.5 CPU and images up to 1 GB. A project holds 2 apps, a 128 MB Postgres database and 256 MB of S3 storage. One build runs at a time per app, with up to 10 builds a day on the free plan. See pricing and limits.
Connect Postgres and S3
npx ezhst db create main npx ezhst db info --json npx ezhst storage create files npx ezhst storage info --json
Install libpq-dev and run docker-php-ext-install pdo_pgsql in the Dockerfile, then connect with PDO using the values from DATABASE_URL. Use the AWS SDK for PHP with endpoint set to https://storage.reverhost.com and use_path_style_endpoint set to true. See the Postgres and storage product pages.
Frequently asked questions
Is PHP hosting on Reverhost free?
Yes. It costs $0 per month with no credit card and no trial period, within the published limits.
Is a Dockerfile in my repository used automatically?
No. The Dockerfile is stored on the app. Save it with ezhst build dockerfile set -f Dockerfile, or apply a template, before you deploy.
Is the built-in PHP server fast enough?
For small apps, yes. It handles one request at a time per worker, so busy apps are better served by a Dockerfile that runs FrankenPHP or PHP-FPM behind a web server.
Start for free
Install the skill, choose Global or Local, then tell your agent to deploy. No credit card, no config files.
$npx ezhst skill install