Way back, PHP was designed to be a language without framework.
Since then, lots of frameworks have been created with Laravel and Symfony being among the most popular today.
Despite the availability of frameworks, you can still use PHP without them - and here is what you must do to deploy your no-framework application on Runway.
All you need is a web server. Imagine the following file tree:
.
└── htdocs
└── index.php
This is by far the most basic example we can come up with.
The index.php could be the following:
<?php
phpinfo(INFO_ALL & ~INFO_ENVIRONMENT & ~INFO_VARIABLES);
runway app config set FOO=bar
you can use getenv("FOO")
in your PHP code later. The above PHP info is displayed with $_ENV
and $_SERVER
removed, not to expose or leak your configuration.Configure your application to use Apache (php-fpm will come on its own):
runway app config set BP_PHP_SERVER=httpd
[build]
[[build.env]]
name="BP_PHP_SERVER"
value="httpd"
Deploying this example will show you a phpinfo()
which displays the installed PHP version and the PHP extensions which are enabled by default.
Read on here, to learn how to enable custom extensions, e.g. to be able to use your PostgreSQL database on Runway from PHP!