The usual way to do this is to put your PHP or other CGI programs in a directory that is protected from access from the Web server directly and will only be accessed by the CGI itself. The specifics of how you do this depend on which operating system and Web server you have.
for reading and
for writing. Several of these have source code. Admittedly, it's in Visual FoxPro, but I found them intelligible, and I've never used FoxPro, myself.
Dig deeper on Security Resources
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.