Docs menu

Getting started with PHP

Deploy a minimal PHP app to Primcloud end-to-end using a sample repo, in about five minutes.

On this page

Deploy a small PHP app to Primcloud: fork a sample repo, import it, watch the build, and open the app at its *.primcloud.app URL. It takes about five minutes.

Before you start#

You'll need:

  • A Primcloud account. Standard accounts have no monthly fee; compute is metered by the minute once you deploy, from around $5/mo for the smallest app.
  • A git provider connected to your account with access to at least one repo.
  • Optional: PHP 8.4 or newer and Composer installed locally, if you want to run the sample or make changes before deploying.

The sample app#

This guide uses Heroku's heroku/php-getting-started repo, a minimal Slim 4 app that builds on Primcloud with no changes. Fork it into an account you've connected to Primcloud.

The sample ships two files that matter for the build:

composer.json
{
  "require": {
    "php": "^8.4",
    "slim/slim": "^4.0"
  }
}
Procfile
web: heroku-php-apache2 web/

The composer.json pins PHP to the 8.4 line and lists the app's dependencies. The Procfile starts Apache with PHP-FPM and serves from the web/ subdirectory.

1. Create the application#

Hit Import Git Repository on the applications list, then:

  1. Select your fork of php-getting-started.
  2. Configure the branch (main, the fork's default) and a region.
  3. Verify the commit and hit Import.

2. Deploy#

The first deployment starts as soon as the app is created, and its build log streams live. Primcloud finds composer.json, installs PHP and your Composer dependencies, then starts the web process from your Procfile: Apache with PHP-FPM serving web/.

When the deployment's Rollout phase shows Complete, the app is live.

3. Reach the app#

Click the *.primcloud.app URL in the dashboard header to open the sample's homepage.

If it doesn't come up:

  • The deployment's build log has the output from Composer and the build.
  • The Logs tab has your app's output, including PHP-FPM startup errors and uncaught exceptions.
  • Check that the document root in your Procfile is the directory containing index.php: web/ for the Slim sample, public/ for Laravel.
  • Check that your web process listens on $PORT. heroku-php-apache2 and heroku-php-nginx do this for you; a custom entrypoint has to read $PORT itself.

Where to go next#