Wikis & learning

Lay out a small PHP blog project

Start with one HTTP entry point, templates outside the public document root, and configuration separate from the files served as assets.

Question

Lay out a small PHP blog project

Editorial answer

Start with one HTTP entry point, templates outside the public document root, and configuration separate from the files served as assets.

Use public/index.php for routing, src for application code and templates for presentation. Put writable uploads or generated content in a location with an explicit read policy. For a host restricted to a single root, deny access to private application data and verify that denial over HTTP.

Verify the result

Request an image, an article and a private file directly. The image and article should load; the private file should return a denied or missing response.

Discussion

Sign in to participate.