Goldenhost

Runtime

PHP apps

Run a PHP application with Nginx and PHP-FPM, connect it to MySQL, and keep the document root tidy.

Two supported paths

Automatic detection works for standard projects with an index.php or a framework manifest. Choose the automatic build option when creating the project.

A Dockerfile is the explicit path. Use it for Laravel, WordPress, custom extensions, or a specific PHP version. The example below is a compact Nginx + PHP-FPM image.

Dockerfile (PHP 8.3 + Nginx)
FROM php:8.3-fpm-alpine

RUN apk add --no-cache nginx \
 && docker-php-ext-install pdo pdo_mysql opcache

WORKDIR /var/www/html
COPY . .
COPY docker/nginx.conf /etc/nginx/nginx.conf

RUN chown -R www-data:www-data /var/www/html

EXPOSE 8080
CMD ["sh", "-c", "php-fpm -D && nginx -g 'daemon off;'"]
docker/nginx.conf (excerpt)
server {
  listen 8080;
  root /var/www/html/public;
  index index.php;

  location / {
    try_files $uri $uri/ /index.php?$query_string;
  }

  location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
}

Connect MySQL

Create a MySQL database from Databases and attach it to the app. The connection variables are added to the app automatically.

Environment variables
DB_CONNECTION=mysql
DB_HOST=your-db.internal
DB_PORT=3306
DB_DATABASE=your_db
DB_USERNAME=goldenhost
DB_PASSWORD=<shown in the dashboard>
APP_KEY=base64:...
The container filesystem is temporary. Uploads, cache, sessions, and SQLite files must live in a database or a mounted storage path. The demo tier does not include extra storage.

Writable paths

If your app writes uploads, mount storage or use object storage. Do not rely on files inside the container surviving a redeploy.