If you're deploying a PHP application to Viaduct, here are a couple of tips which may help you along the way.

Image

Mastering vdt-php

vdt-php is a service provided by Viaduct which runs an Apache/PHP web server for your application. It sets a number of defaults and ensures that your application is always running. In most cases, this should be configured as public Process Type for your application.

The list below outlines a few of the options which can be passed to the vdt-php application.

  • -p - this sets the port number which the web server should be listening on. In 99.9% of cases this should simply be set to $PORT.

  • -w - this sets the number of worker processes which should be running. The number you run should depend on the amount of memory your application needs. The default is 1.

  • -r - this sets the document root for your application from the root of your repository. For example, if you have a app/webroot folder, you should set this value to app/webroot. No files below this web root will be served by the web server.

  • -E -this instructs PHP to display all errors to the user. By default, our PHP configuration hides all errors however you can override this behaviour by passing this option.

Custom PHP Configuration

If you wish to set custom PHP configuration, you can do so by adding a config file called .user.ini (note the preceeding dot). This can contain values which will be loaded by PHP. For example,

display_errors = On
error_reporting = E_ALL ^ E_NOTICE ^ E_WARNING

Further Reading

If you want to read more about our PHP environment, you can do so in our documentation.

Tell us how you feel about this post?