Solved

File Structure of PHP in Web Hosting

Posted on 2002-05-20
2
362 Views
Last Modified: 2013-11-18
According to my limited knowledge, when writing a Website including CGI and putting it in a Web hosting company, the Web hosting company usually instructs you to put all HTML files in the folder "public_html" and all CGI files in the folder "cgi-bin".  The folder "cgi-bin" is usually inside the folder "public_html".

How will the file structure be when writing a Website including PHP?

Will it be only like writing a Website including ASP (i.e. the ASP files can be put anywhere and not like those Websites including CGI)?

Thank you very much for the attention.
0
Comment
Question by:ppk78
2 Comments
 
LVL 32

Expert Comment

by:Batalf
ID: 7023409
Yes, with PHP you could put the files anywhere you like within your webtree.

The recommendation from web hosting companies is an instruction to you to follow their predefined filestructure.
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 50 total points
ID: 7023493
The reason for the CGI-BIN directory is that the ISP will have set access rights on this directory to allow it to be used to execute server side scripts - .pl or .cgi scripts for example. This directory is physically outside the root of the web-site and (in theory) is protected against regular browsers from seeing the contents.

The public_html directory is the pubic face for your web site.

This directory contains all the images, sound, HTML pages for your web site.


So far so good. But what about PHP files which are both server-side scripts AND html-like files?

I treat them as HTML files.

I think that if you put them in the cgi-bin directory, the server will attempt to execute the file based upon the extension and NOT pass it through the web-server. I THINK!!!! (Or it may be the first line in the file which contains the name of the program that should be used to execute it).

I use Windows with the ISAPI PHP Module and PHP files are passed through the web-server to this module. The same is true for ASP and CFM (as far as I know).

So.

Put them in the public_html directory. Treat them as HTML files in that respect.

Regards,

Richard Quadling.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to dynamically set the form action using jQuery.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question