Ask a Question related to PHP Development, Design and Development.
-
Andrew C. #1
Where should PHP scripts go?
Hi folks,
In developing a website containing both HTML files and PHP files, I had
thought that it was good practice (or even mandatory depending upon
webserver configuration) that the PHP files should reside in a cgi-bin
directory. However, when I did a quick test on webspace that's being hosted
for me (using Apache if that makes any difference), a PHP script placed in
the cgi-bin directory doesn't work, yet placed outside of that directory, it
runs fine.
Based on my limited understanding, this seemed to me to be exactly the wrong
way around, but when I put this point of view to the hosting company's
customer services, they said:
----------
Its a cgi bin. For CGI scripts. PHP does not work like that.
basically the CGI-bin is a safe place to store CGI scripts. It won't ever
display the source code.. whereas if you put it outside the cgi-bin..and if
u have an error..it has the ability to display the source.
PHP wont display the source unless you specifically display it.
----------
Sadly, I don't think I really understand this reply. Could anyone throw some
light on my misunderstanding, or perhaps easier still, does anyone know of
any guide or tutorial to laying out (in terms of directory structure) a
website?
I've tried what I consider to be reasonable search phrases, but don't seem
to be able to find any documentation that addresses my questions.
Thanks for any assistance,
A.
Andrew C. Guest
-
php scripts
Does anyone know of like some customizeable script that allows me to have one icon if there is a user logged in and another if nobody the user is not... -
How di I use scripts?
I found a great paginating script, but I have no idea how to use it. Thanks (script below) myPages = app.documents.pages; // Let's make sure... -
CS: Scripts do not appear in Scripts menu
I have several utility AppleScripts that I created for Illustrator 10. I'd like to use these in CS, and they work correctly when I choose "Browse"... -
scripts that control other scripts
Is there any behaviour script that when attached to a sprite can control the functionality of any other scripts attached to that sprite? I want to... -
ASP scripts from IIS 4 to IIS 5
> Set objLog = objFile.OpenTextFile(Server.MapPath Do you have the Norton and/or McAfee Viruses (err, anti-virus products) installed?... -
thomas L. #2
Re: Where should PHP scripts go?
Andrew C. wrote:
hey andrew,> Hi folks,
>
> In developing a website containing both HTML files and PHP files, I had
> thought that it was good practice (or even mandatory depending upon
> webserver configuration) that the PHP files should reside in a cgi-bin
> directory. However, when I did a quick test on webspace that's being hosted
> for me (using Apache if that makes any difference), a PHP script placed in
> the cgi-bin directory doesn't work, yet placed outside of that directory, it
> runs fine.
>
> Based on my limited understanding, this seemed to me to be exactly the wrong
> way around, but when I put this point of view to the hosting company's
> customer services, they said:
>
> ----------
> Its a cgi bin. For CGI scripts. PHP does not work like that.
>
> basically the CGI-bin is a safe place to store CGI scripts. It won't ever
> display the source code.. whereas if you put it outside the cgi-bin..and if
> u have an error..it has the ability to display the source.
>
> PHP wont display the source unless you specifically display it.
> ----------
>
> Sadly, I don't think I really understand this reply. Could anyone throw some
> light on my misunderstanding, or perhaps easier still, does anyone know of
> any guide or tutorial to laying out (in terms of directory structure) a
> website?
>
> I've tried what I consider to be reasonable search phrases, but don't seem
> to be able to find any documentation that addresses my questions.
>
> Thanks for any assistance,
> A.
>
>
personally i don't put my php-files in a protected directory, only the
files with valuable information (passwords, ...) are protected in a
private-directory (protected with .htaccess).
now, i suggest you make a directory and do a quick search on .htaccess
(google gives good results on this one, or this NG too).
normally i work like this:
private-directory for all valuable php-files
web-directory:
- style (all css)
- images (all images)
- php-files (all php-files)
- html-files
- directory's for other sites (more sites on one server)
untill now it works fine for me, no problems at all.
hope this covers a part of your question...
cheerz and good luck,
thomas
thomas L. Guest
-
Jonathan Christensen #3
Re: Where should PHP scripts go?
"Andrew C." <backwards.moc.senrocwerdna@swenaret.backwards> wrote in message
news:aef8b0cabfdc9584ef45f323e625dc08@news.teranew s.com...hosted>
> Hi folks,
>
> In developing a website containing both HTML files and PHP files, I had
> thought that it was good practice (or even mandatory depending upon
> webserver configuration) that the PHP files should reside in a cgi-bin
> directory. However, when I did a quick test on webspace that's beingit> for me (using Apache if that makes any difference), a PHP script placed in
> the cgi-bin directory doesn't work, yet placed outside of that directory,wrong> runs fine.
>
> Based on my limited understanding, this seemed to me to be exactly theever> way around, but when I put this point of view to the hosting company's
> customer services, they said:
>
> ----------
> Its a cgi bin. For CGI scripts. PHP does not work like that.
>
> basically the CGI-bin is a safe place to store CGI scripts. It won'tif> display the source code.. whereas if you put it outside the cgi-bin..andsome> u have an error..it has the ability to display the source.
>
> PHP wont display the source unless you specifically display it.
> ----------
>
> Sadly, I don't think I really understand this reply. Could anyone throwWith PHP files, you just put the files anywhere you like--just like HTML> light on my misunderstanding, or perhaps easier still, does anyone know of
> any guide or tutorial to laying out (in terms of directory structure) a
> website?
files. This is because when a user accesses a PHP file on the server, a
complier program on the server compiles the page before sending to the user.
What the user sees is essentially just an HTML page (well, of course, PHP
could also generate HTML pages with e.g. Javascript, but that's besides the
point.)
Jonathan
> I've tried what I consider to be reasonable search phrases, but don't seem
> to be able to find any documentation that addresses my questions.
>
> Thanks for any assistance,
> A.
Jonathan Christensen Guest
-
Andrew C. #4
Re: Where should PHP scripts go?
Thomas and Jonathan -- thanks for your advice.
I guess I just had (and still have probably) a misunderstanding about what
cgi-bin directories are for, but at least now I know that PHP doesn't belong
there. :)
Thanks again!
A.
Andrew C. Guest
-
Savut #5
Re: Where should PHP scripts go?
It's depend on how is configured Apache, and how is run PHP, as CGI or as
Module.
PHP can be both CGI or module, it's just different the way the server handle
the page. In a few words, take CGI as a program PHP is run everytime to read
the code then is closed after, while Module is the PHP is already loaded
with the server and is waiting to read a PHP page when needed.
That's why CGI files must be within a special directory with the Permission
Execute (cgi-bin). Module dont need Permission Execute, and will work will
php normally, that's why you can put it anywhere.
That's also why C++ and Perl are also CGI.
Savut
"Andrew C." <backwards.moc.senrocwerdna@swenaret.backwards> wrote in message
news:6a51657be569c5ac8f84d7ac73607d8b@news.teranew s.com...>
> Thomas and Jonathan -- thanks for your advice.
>
> I guess I just had (and still have probably) a misunderstanding about what
> cgi-bin directories are for, but at least now I know that PHP doesn't
> belong
> there. :)
>
> Thanks again!
>
> A.
>
>Savut Guest



Reply With Quote

