?
Solved

File Structure of PHP in Web Hosting

Posted on 2002-05-20
2
Medium Priority
?
375 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 200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
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 how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

850 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