Custom PHP Deployment
Custom PHP deployment is for any PHP application that is not Laravel or WordPress — frameworks like Symfony, CodeIgniter, Slim, CakePHP, or plain PHP projects. PieApp detects a custom PHP app when composer.json is present at the repository root but no artisan file or WordPress config is found.
Your app runs inside a Docker container with PHP-FPM and Nginx, served at https://yourapp.pie.host with automatic HTTPS.
If your project does not use Composer, you can override the type manually using pie.json (see Getting Started).
Requirements
- A Git repository with composer.json at the root (or a pie.json override)
- An SSH deploy key added to your repository and your PieHost account
- Your app's entry point accessible from the document root (default: /)
Getting Started
1. Go to the PieApp dashboard and create a new app pointing to your repository.
2. If your project does not have a composer.json, PieApp won't auto-detect it as PHP. Add a pie.json to your repo root to force the type:
{
"type": "php",
"subtype": "customphp"
}
3. Set your PHP Version, Build Commands, and Public Directory in the Settings tab.
4. Add any required environment variables in the Environment tab.
5. Click Deploy.
PHP Version
Select the PHP version from the Settings tab. Supported versions: 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3.
Changing the PHP version triggers a cold deployment — the entire image is rebuilt from scratch.
Build Commands
Set these in the Settings tab under Build Commands. For a Composer-based project:
composer install --no-dev --optimize-autoloader
For frameworks that require additional setup steps:
Symfony
composer install --no-dev --optimize-autoloader
php bin/console cache:warmup --env=prod
CodeIgniter / Slim / other
composer install --no-dev --optimize-autoloader
Commands run in order. If any command exits with a non-zero status the deployment is marked failed and the previous version stays live.
Environment Variables
Add your configuration in the Environment tab, one per line in KEY=VALUE format:
APP_ENV=production
DB_HOST=your-db-host
DB_NAME=your_database
DB_USER=your_db_user
DB_PASSWORD=your_db_password
Variables are written as a .env file inside the container at /app/.env and are also available as real environment variables, so both $_ENV['KEY'] and getenv('KEY') work.
Document Root
The Public Directory setting tells PieApp which folder Nginx should serve as the web root. Set it in the Settings tab.
| Project layout | Public Directory setting |
|---|---|
| index.php at repo root | / |
| Entry point at public/index.php | public |
| Entry point at web/index.php (Symfony) | web |
| Entry point at www/index.php | www |
The default is /. If your index.php lives in a subdirectory and you leave this as /, Nginx will return a 404.
Cron Jobs
Add scheduled tasks via a pie.json file in the root of your repository:
{
"crons": [
{
"schedule": "0 * * * *",
"command": "/usr/bin/php /app/bin/cleanup.php"
}
]
}
All files in your repository are available under /app/ inside the container. Changes to pie.json take effect after the next deployment.
Common Issues
404 on all pages
Your entry point is likely not at the repo root. Set the Public Directory in Settings to the folder containing your index.php (e.g. public, web, www).
500 error / blank page
Enable error output temporarily by adding to the top of your index.php:
ini_set('display_errors', 1);
error_reporting(E_ALL);
Remove these lines once the issue is resolved.
Composer packages missing after deployment
Make sure composer install is in your Build Commands. The vendor/ directory is not committed to the repository and must be installed during each deployment.
.env file not found by my framework
Your .env file is written to /app/.env inside the container. If your framework looks for it elsewhere, symlink it in your Build Commands:
composer install --no-dev
ln -sf /app/.env /app/config/.env
Help
Facing difficulties? Use the chat box on the bottom-right corner of this page to reach us.
