1.1. Plan the Directory Layout

The first step is to plan the directory structure for the application. I'm going to recommend you create three main folders: One named public_files from which all publicly accessible files will be served, another named lib to store include files to be shared by any number of other files, and finally a templates folder to store presentation files. Although PHP will be able to reference files from anywhere in your setup, the web server should only serve files from the public_files folder. Keeping support files outside of the publicly accessible directory increases security.

Inside the public_files I also create css to store any style sheets, js for JavaScript source files and img for graphic files. You may want to create other folders to keep yourself organized. One named sql to store MySQL files would be a good idea, doc for documentation and development notes and tests to store smoke test or unit testing files.

Get PHP and MySQL®: Create-Modify-Reuse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.