Since this is a PHP + MySQL application, deploying to Vercel requires some specific configuration because Vercel is designed for static sites and serverless functions, not traditional PHP hosting.
If you really want to use Vercel, you need two things:
- A Cloud Database: Vercel does not host databases. You need a remote MySQL database.
- Configuration: I have added a
vercel.jsonfile to the project to handle PHP files.
- Get a Database: Sign up for a free MySQL database at Aiven, PlanetScale, or Railway.
- Get Credentials: Note down your
Host,User,Password, andDatabase Name. - Upload to GitHub: Push this project to a GitHub repository.
- Import to Vercel:
- Go to Vercel Dashboard -> Add New -> Project -> Import from GitHub.
- Environment Variables: In the project settings, add the following variables with your database details:
DB_HOSTDB_USERDB_PASSDB_NAME
- Deploy: Vercel will build the project using the configuration I added.
Railway.app is much better suited for this project because it supports PHP and MySQL natively.
- Upload code to GitHub.
- Login to Railway.
- Click "New Project" -> "Deploy from GitHub repo".
- Right click on the canvas -> "New" -> "Database" -> "MySQL".
- Connect the two services (Variables are usually auto-injected, or you can copy them manually).
Use any standard PHP hosting provider like Hostinger, Bluehost, or 000webhost (free).
- Upload files to
public_html. - Create a MySQL database in their control panel.
- Import
database_setup.sql. - Edit
inc/init.phpmanually with the credentials if environment variables aren't supported.