Hostwizly

How To Deploy PHP App On Vercel FREE

Last Updated 05 May 2025 by Jarvis Silva

Looking for tutorial on how to host php website on Vercel platform then you are at the right place in this article I will show you how to deploy php app on Vercel web hosting platform.

Vercel is a cloud web hosting service which is popular for hosting web apps made using next js, react or other frontend frameworks but you may not know that you can host php on vercel serveless functions by using their php runtime.

Note: one thing you need to keep in mind that Vercel is not optimised for php so it is not recommended to host production applications or large apps, use it only for small cases or personal use.

I will deploy a simple php api which returns hello world and I will use Vercel free tier plan to deploy it, so now let's see how to deploy step by step.

1. Configure php project to deploy to Vercel

First we need to configure our php project to make it deployable on Vercel.

  1. First create a api folder, add a index.php file inside it and add a basic php api code that returns hello world on get request, you can see from below.
  2. PHP Api demo code
  3. Now we need to create a vercel.json file in the root of the project and add some code in it so copy the below code and paste in your vercel.json file
  4. {
        "functions": {
            "api/**/*.php": { runtime: "vercel-php@0.6.0" },
        },
        "routes": [
            { src: "/(.*)", dest: "/api/index.php" }
        ],
    }

    Basically with the vercel.json file we tell Vercel we want to use php runtime and the location of our routes.

Now our php api is ready to deploy on Vercel, refer here for more advanced configuration: Using Vercel Serveless Functions.

2. Upload code to Github

To deploy any code on Vercel we need to first upload the code on Github repository, follow below steps.

  1. Open Github and login to your account, click on create a new repository, enter your app name, leave rest everything default and click create repository.
  2. Now it will show you commands to push your code to this repository, open a terminal at your static website code location and run all the commands one by one or you can drag and drop.
  3. Github new repository page with commands

Read: How to push code to github

After you run all the commands you should see your code uploaded to your Github repository.

3. Deploying PHP code to Vercel

Now we just need to deploy our php app code on Vercel for that you need to have your Github connected with your Vercel account.

  • Go to your Vercel dashboard and click on the add new button it will open a dropdown in that click on project.
  • Vercel new project button page
  • Now it will open a new page displaying your Github repositories, now here you need to click on import of your php website code repository you want to host.
  • Vercel git repo import page
  • Now it will ask you to enter your project name, leave the other settings as default and click on deploy.
  • vercel project deployment final step

Now it will start building your website and deploy it on Vercel, it will generate some preview url to view your php website or app, you can also connect a custom domain if you have.

Also Read: Deploy express app to Vercel

So we successfully hosted our php application on Vercel, I hope you found this tutorial helpful and you were able to deploy your php app to vercel. Thank you for reading, Have a nice day 😊

About the author

I am Jarvis Silva, a tech enthusiast. I have 5 years of experience in website hosting and development, Now sharing all my knowledge related to web hosting and other various tech on the internet through Hostwizly.

Free Wordpress Website Setup

We will setup your wordpress website for free and get you started on your online journey.

Claim

Related Articles