Questions | Login

Top / PHP

Proper location of HTML and PHP?

demo 19 Dec 2008 09:13am
I have a website that will (among other things) use PHP scripts to enter and retrieve data from a MySQL database. Should the PHP scripts be placed in the cgi-bin or can/should they be located in the htdocs along with my HTML content?

Answers

demo 19 Dec 2008 09:16am
I always had mine side by side, and everything worked fine.
demo 19 Dec 2008 09:30am
You can place them wherever you want.
demo 19 Dec 2008 09:43am
Depends what the PHP scripts do.

Normally you would want to come up with your old framework and keep only the files that need to be accessed by the public (ie the web) inside your web accessible folder. You wouldn't want to place any scripts there, configuration data and potentially classes unless you ensured that your web server did not serve those files up, otherwise people could piggyback off your scripts.
demo 19 Dec 2008 11:47am
The PHP scripts should be located in the part of your HTML file where you want the PHP information be shown. Just follow this syntax:

<?php
//Your PHP script.
?>

Related

Submit Answer

You must be logged in to post an answer. Please Login or Register.

Powered by phpMyAnswers.