PHP + MySQL API
BeginnerApi OnlyClassic PHP and MySQL backend: simple, widely hosted, and proven at scale.
Published 27 September 2026
About PHP + MySQL API
PHP with MySQL is one of the most battle-tested combinations in web development, powering a significant portion of the internet, including WordPress and countless business applications. PHP processes HTTP requests server-side, queries a MySQL database, and returns JSON responses. No framework is required, though frameworks like Laravel build on this foundation.
The stack's biggest practical advantage is deployment ubiquity: virtually every shared hosting provider and VPS supports PHP and MySQL out of the box. A small VPS gives you dedicated resources, full control, and predictable fixed-cost hosting. Setup is straightforward: install PHP and MySQL, write your scripts, point a domain at the server.
This stack is ideal for beginners learning server-side development without framework abstractions, developers building simple APIs for existing PHP ecosystems, or anyone who needs a backend that can run on the cheapest possible hosting infrastructure.
Key Features
- ✓No framework required, just PHP files and MySQL queries
- ✓JSON API responses with PHP's built-in json_encode()
- ✓MySQL relational database with full ACID compliance
- ✓Hetzner VPS for dedicated, fixed-cost hosting
- ✓PDO for parameterized queries and SQL injection prevention
- ✓Runs on any hosting that supports PHP, from shared hosts to VPS
When to Use PHP + MySQL API
- →Beginners learning server-side API development without framework overhead
- →Simple CRUD APIs for WordPress or other PHP-based frontends
- →Migrating or extending legacy PHP codebases
- →Budget deployments where shared PHP hosting is sufficient
- →Prototyping database-backed APIs quickly without build steps
Pros
- Lowest possible barrier to deployment: runs everywhere
- Large talent pool and decades of tutorials and documentation
- Direct, explicit code with no magic or convention-over-configuration
- MySQL is extremely well-understood and easy to manage
Cons
- No type safety or structure enforcement without a framework
- Manual handling of routing, validation, and middleware
- PHP's inconsistent standard library requires discipline to use safely
Hosting Options for PHP + MySQL API
A self-hosted VPS running the PHP backend yourself, the classic way PHP has been hosted for decades: PHP-FPM, MySQL, and Nginx or Apache on one server, deployed by copying files or pulling from git. Entry-level instances start around €4-5/mo, the cheapest option here, at the price of handling OS updates, backups, and TLS yourself.
A budget-friendly PHP-focused host with one-click MySQL provisioning, built specifically around the classic PHP + MySQL hosting model this stack uses. Shared hosting plans start under $3/mo; VPS plans for more control start around $5-8/mo.
A managed VPS or App Platform deployment with predictable flat-rate pricing. A basic Droplet (around $4-6/mo) runs a standard LAMP or LEMP setup, with a one-click LAMP image in the Marketplace; App Platform builds the PHP app from the repo with no server to manage, and managed MySQL is a separate add-on.
A persistent-service platform with a genuinely free tier, running the PHP backend from a Docker image since Render has no native PHP runtime. It also has no managed MySQL, so the database runs as a private service with a persistent disk or on an external host. Free-tier services spin down after inactivity; always-on pricing starts around $7/mo.
A container-based platform where the PHP backend deploys as a persistent service built from the repo, with MySQL running as a separate service in the same project. No free tier: the Hobby plan starts around $5/mo in usage credit, plus usage-based billing for CPU, memory, and network.
These are highlighted picks. To see all the tools, check the Hosting & Cloud category.
PHP + MySQL API Add-ons
Each addition below extends this stack with a capability the base stack works fine without. None are required: include the ones your product actually needs when building this stack, and skip the rest.
Authentication Add-ons
Add authentication when the app needs user accounts — sign-up, login, and data scoped to a specific user instead of a fully open app.
These are highlighted picks. To see all the tools, check the Authentication category.
CI/CD Add-ons
Add CI/CD when you want a dedicated pipeline for running tests, linting, or multi-stage builds before a deploy goes out. Many hosting platforms already redeploy automatically on every push on their own — a CI/CD tool adds the most value on top of that by gating the deploy on a passing test suite, and matters even more when the hosting choice does not auto-deploy at all, such as a self-hosted server.
Runs the test suite and triggers deployments on every push, directly from the same GitHub repo the code already lives in, with no separate CI service to configure.
These are highlighted picks. To see all the tools, check the CI/CD Pipelines category.
Containerization Add-ons
Add containerization when you want the app packaged the same way across local development, staging, and production, or need to deploy somewhere that isn't a managed serverless platform.
These are highlighted picks. To see all the tools, check the Containerization category.
Email Add-ons
Add email when the app needs to send account verification, password reset, or notification messages.
A transactional email API for account verification, password resets, and notification emails, sent via Resend's official PHP SDK, with a free tier for getting started.
The established high-volume choice, with dedicated IP addresses and deliverability tooling for apps sending at serious scale. No permanent free plan (a 60-day trial, then paid tiers), so it earns its slot when volume and deliverability matter more than upfront cost.
Payments Add-ons
Add payments when the product is ready to charge for subscriptions or one-time purchases.
Frequently Asked Questions about PHP + MySQL API
How does this compare to Laravel Starter?
This stack is bare PHP with no framework at all: you write routing, request handling, and security by hand. Laravel gives you Eloquent, Blade, and a full toolkit out of the box, at the cost of a framework's opinions. Pick this one only if you specifically want zero framework overhead or are maintaining a legacy codebase already built this way.
Should I add a framework later, or stay framework-free?
Bare PHP is a reasonable choice for a small, simple API, but it doesn't scale well as routes and validation logic grow, and most teams that outgrow this stack move to Laravel rather than continuing to hand-roll structure. There's no clean "upgrade path" migration; adopting Laravel later means restructuring the app around its conventions.
Should I use Auth0?
Auth0 is the only provider here since bare PHP has no framework-native auth system the way Laravel does, and it's the most direct way to add authenticated routes without hand-rolling session or token handling.
What's the cheapest way to run this stack?
Shared hosting plans bundling PHP and MySQL start under $3/mo, the cheapest hosting path in this entire catalog. A VPS for more control (Hetzner, Hostinger, DigitalOcean) runs about $4-8/mo instead.
Stacks Related to PHP + MySQL API
WooCommerce Store
ProjectWordPress-powered e-commerce on a self-managed server with full control over data.
WordPress Site
ProjectWordPress CMS with MySQL or MariaDB for no-code content sites and blogs.
HTMX + Laravel
ProjectLaravel Blade templates enhanced with HTMX: PHP interactivity without writing JavaScript.
Ghost Self-Hosted
InfrastructureSelf-hosted Ghost: publishing, memberships, and newsletters with your content and members on your own server.
Scores
Popularity4/5
PHP and MySQL together power a huge share of the web's existing sites, and this exact pairing has decades of hosting support and documentation behind it — about as proven and widely-hosted as a backend combination gets.
Learning Curve2/5
Plain PHP has one of the lowest barriers to entry of any backend language — no framework conventions to learn, no build step, just functions and MySQL queries. The tradeoff is that structure, routing, and security are entirely up to you.
Flexibility3/5
With no framework at all, there's nothing to fight — add whatever routing pattern, query approach, or structure fits. Not a higher score because "no framework" also means no sensible defaults; every decision is manual.
Performance3/5
Plain PHP with MySQL handles typical CRUD traffic fine on shared or budget hosting, but without a framework's optimizations (query builders, caching layers) it's easy to write inefficient queries by hand.
Portability5/5
Plain PHP with no framework and MySQL (a standard, widely-supported database) is about as portable as a backend gets — deployable to virtually any PHP hosting environment that has existed in the last two decades.
Tools in the PHP + MySQL API Stack
PHP + MySQL API Pricing
Plain PHP and MySQL are open-source and free, and this stack is about as cheap to host as a backend gets: many shared hosting plans bundle both for under $3/mo. A VPS for more control runs about $4-8/mo on Hetzner, Hostinger, or DigitalOcean.
PHP and MySQL are free.
Shared hosting from under $3/mo; a VPS on Hetzner, Hostinger or DigitalOcean for more control from about $4–8/mo.