PHP
Learn how to deploy a simple PHP application to Valyent
Introduction
PHP is a popular server-side scripting language that makes it easy to create dynamic web pages. This guide will help you deploy a simple PHP application.
Prerequisites
- a UNIX-like system (see WSL if you are using Windows), in order to use the Valyent CLI
- a Valyent account, with a registered payment method (you can sign up here)
- PHP installed on your machine
Installing the CLI
You can inspect the installation script here and the GitHub repository.
Authenticating
Initializing the project
First, let’s create a new directory and add our PHP file:
In the index.php
file, add this simple code:
Now, initialize the valyent.toml
configuration file:
This command will ask you to select/create a project and an associated application.
Adding the Dockerfile
Create a Dockerfile for the application:
Add the following content:
Deploy the project
To expose the application’s port, we need to set up a gateway (in this case, the port 80):
Deploy your application to Valyent:
Once the deployment is finished, open your application:
Your simple PHP application should now display “Hello, World!” in the browser.