Solved

File Structure of PHP in Web Hosting

Posted on 2002-05-20
2
355 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:
RQuadling 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now