A Static Export Workflow for Django and PHP
Use familiar server templates to generate public HTML while keeping runtime requirements explicit.
The field guide / PHP
A PHP static website builder workflow runs PHP before publication and saves its rendered output as HTML. This lets you reuse familiar templates while delivering ordinary public files. The build environment needs PHP; a file-only host receives the finished output.

PHP can execute scripts from the command line. Create an exporter that prepares public data, renders a template, and writes the result to its intended route. Keep content selection and filesystem handling in the build process so errors can stop an incomplete release.
Review assumptions about cookies, request headers, and server paths. Templates written for visitor requests may need adaptation before they run reliably in a build. Avoid rendering code that sends messages or changes stored records as a side effect.
The public folder should contain completed HTML, stylesheets, images, and required browser scripts. Uploading PHP source to a file-only host does not provide a PHP runtime. Keep configuration, credentials, source data, and private templates outside the deployable directory.
Define clean URLs and reject duplicate destinations before writing files. Escape ordinary text for its output context, validate links, and inspect the produced markup. The HTML publishing guide provides a baseline for the exported documents.
Decide which operations still require a server. Contact delivery, authentication, and shared persistent data need an appropriate service; a saved page alone cannot perform them. Remove controls that have no working destination and test retained integrations from the final origin.
Rebuild after approved content changes and retain a recoverable previous artifact. Read the Django and PHP export workflow, or compare the Django template approach when choosing a build environment.
A file-only static host serves files without executing PHP. Run PHP during the build and upload the resulting HTML, or choose application hosting when request-time PHP is required.
Yes. Include those templates while generating the pages. The completed HTML already contains the shared markup when visitors request it.
Primary reference: PHP: command-line usage.