Solved

File Structure of PHP in Web Hosting

Posted on 2002-05-20
2
361 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
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.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

785 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