Using Netlify for complex dynamic website?

Hi. I’m interested in using Netlify for my dynamic website and I’d like to know if this is possible. All the documentation I can see only references static websites.

My website uses a PHP framework, so the hosting provider must have PHP installed and a few PHP extensions.

I’m mainly interested in Netlify for the Git convenience and also the CDN advantages, and their privacy policy looks good to me.

I assumed I could connect my live website to it and, after validation and caching, it would start serving my website across its CDN and that the website’s source would be visible to me within Netlify for editing.

Instead, I only see the option to add a repo (under sites) or add a domain to Netlify’s DNS (under domains). Is it necessary to use Netlify’s DNS in order to use its CDN? I’m happy with my current DNS setup so at the most I’d use Netlify as a secondary/backup DNS.

Please let me know if I am completely misunderstanding the purpose of Netlify and if I need to look elsewhere.

No, it’s not possible using just Netlify hosting. Netlify allows the use of JavaScript, APIs, and HTML markup (or something that generates HTML markup such as one of the Static Site Generators).

Depending on how much your site relies on PHP for dynamic content, you could set up a local instance of a server on your computer, develop your site in PHP, and then spider / archive / scrape / download it (using HTTRACK, SiteSucker, Blue Crab, etc.) and upload that set of files to Netlify. This is probably not what you are seeking, though.

If you need inexpensive hosting for your PHP site(s), check out Digital Ocean.

@Ace2213 we have a “common issue” topic about this here:

tl;dr - A deployed website at Netlify cannot run PHP code. Client side javascript can call APIs which are powered by PHP, but the web server itself isn’t running PHP.

To summarize, you can run PHP (or a number of other languages) during the site build process at Netlify. Netlify does not support running an application server (aka: language runtime) during site browsing - only during the build process.

This is because Netlify is specifically designed for JAMStack sites:

With a JAMStack site, there is no code executed on the server - so all dynamic site content must come from javascript in the end user’s browser making API calls.

If you have other questions, we are happy to answer.