Solved

File Structure of PHP in Web Hosting

Posted on 2002-05-20
2
366 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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 the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

696 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