bars icon close icon
magnifying-glass icon

Laravel

You can run different types of applications on PHP using Hostman: APIs, background workers, cron jobs, private services, and more.

Hostman provides CI/CD for all types of services, as well as great scalability.

To deploy a Laravel application, follow these steps.

Deployment

Step 1. Create a service

Click Create in the top-left corner of your Dashboard and choose Back-end app.

enter image description here

Step 2. Select the project to deploy

If you are logged in to Hostman with your GitHub, GitLab or Bitbucket account, at this point you will see the repository with your projects, including the private ones.

Choose the project you want to deploy.

To access a different repository, click Connect another repository.

If you didn’t use your Git account credentials to log in, you’ll be able to access the necessary account now, and then select the project.

Step 3. Choose a server

Your Laravel application must run on a specific cloud server. Choose the location and configuration of this server. You can upgrade it in the future.

enter image description here

Step 4. Configure the build settings

Next, the App customization window will appear.

enter image description here

First, select PHP environment and then Laravel from the list of frameworks.

In most cases you can use the default value of the start command and leave the build command empty.

The default Start command is:

php artisan serve --host 0.0.0.0

The Build command allows you to customize the build process. You can enter multiple commands separated by &&.

PHP uses a composer dependencies manager. You don't have to include this in the Build command. Hostman detects the composer.json file and installs all dependencies on its own.

Step 5. Deploy

Click Deploy to start the build process.

Once it starts, you will enter the deployment log. The log contains all the debugging data you'll need. If there are any issues with the code, you will get warning or error messages in the log, specifying the cause of the problem.

Usually it takes some time to install the cloud server during the first deployment.

When the deployment is complete, you will receive an e-mail notification and also see a similar log entry:

enter image description here

All done!

Your project is up and ready.

Troubleshooting

The deployment fails

If the deployment fails, first of all check the deployment log. You'll see the stage where something went wrong.

The most common issues are with the start command. Check that everything is working properly in your development environment. Check that all the packages your application needs are in the composer.json file.

Also, we are here to help, so don't hesitate to ask us about the causes via chat.