- Supported versions
- Deprecated versions
- Alternate start commands
- Debug PHP-FPM
- Project templates
PHP is a popular scripting language designed especially for the web. It currently powers over 80% of websites.
Note that as of PHP 7.1 we use the Zend Thread Safe (ZTS) version of PHP.
To select a PHP version, specify a
type such as
# .platform.app.yaml type: "php:7.3"
The following versions are available but are not receiving security updates from upstream, so their use is not recommended. They will be removed at some point in the future.
PHP is most commonly run in a CGI mode, using PHP-FPM. That is the default on Platform.sh. However, you can also start alternative processes if desired, such as if you're running an Async PHP daemon, a thread-based worker process, etc. To do so, simply specify an alternative start command in
platform.app.yaml, similar to the following:
web: commands: start: php run.php upstream: socket_family: tcp protocol: http
The above configuration will execute the
run.php script in the application root when the container starts using the PHP-CLI SAPI, just before the deploy hook runs, but will not launch PHP-FPM. It will also tell the front-controller (Nginx) to connect to your application via a TCP socket, which will be specified in the
PORT environment variable. Note that the start command must run in the foreground.
If not specified, the effective default start command varies by PHP version:
- On PHP 5.x, it's
- On PHP 7.0, it's
- On PHP 7.1, it's
- On PHP 7.2, it's
- On PHP 7.3, it's
While you can call it manually that is generally not necessary. Note that PHP-FPM cannot run simultaneously along with another persistent process (such as ReactPHP or Amp). If you need both they will have to run in separate containers.
If you want to inspect what's going on with PHP-FPM, you can install this small CLI:
dependencies: php: wizaplace/php-fpm-status-cli: "^1.0"
Then when you are connected to your project over SSH you can run:
$ php-fpm-status --socket=unix://$SOCKET --path=/-/status --full
A number of project templates for major PHP applications are available on GitHub. Not all of them are proactively maintained but all can be used as a starting point or reference for building your own website or web application.
- EZ Platform
- Drupal 7
- Drupal 7 Commerce Kickstart
- Drupal 8
- Drupal 8 (Multisite variant)
- Magento 1
- Magento 2