You cannot run PHP code directly on a Webflow-hosted site, because Webflow is a static hosting platform that doesn't support server-side languages like PHP. However, there are alternative methods to extend functionality beyond the native CMS.
1. Why PHP Doesn't Work on Webflow
- Webflow hosting supports only static HTML, CSS, JavaScript, and Webflow CMS data.
- No server-side scripting (like PHP, Python, or Ruby) is executed on Webflow servers.
2. Use Third-Party Backend Services
To implement complex backend features, use external services and connect them to your Webflow site.
- Make.com (formerly Integromat) or Zapier for workflow automation.
- Xano, Firebase, Airtable, or Supabase for backend logic and databases.
- Replace PHP scripts with JavaScript (AJAX) requests to communicate with these services.
3. Use Webhooks or Custom APIs
Use JavaScript to send data to external APIs you control.
- Host your PHP or Node.js logic on a separate server (e.g., Vercel, Netlify Functions, AWS Lambda, or your own server).
- Use fetch() in Webflow’s Custom Code section or Embed elements to call your backend logic.
4. Export Code as an Alternative
If you want to use Webflow only for design, you can:
- Export your Webflow site’s code (only available on paid plans).
- Host it on a PHP-enabled server, like cPanel, Apache, or Nginx environments.
- Add your PHP scripts directly there.
Keep in mind: once exported, Webflow CMS and native interactions will stop working.
Summary
You cannot run PHP code on a Webflow-hosted site. To implement complex functionality, use external tools or APIs and connect them using JavaScript. If you require full backend control, consider exporting your code and managing it on your own server.