Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to run php in cgi-bin folder?

Status
Not open for further replies.

alan123

MIS
Oct 17, 2002
149
0
0
US
I have a php file which runs correctly in document folder, now I want to move it to the cgi-bin folder, however it shows blank page when I try to access it, why the same php file cannot run in the cgi-bin folder, what approach I need to take (modify httpd.conf?) to have this file runs correctly in cgi-bin folder?
thanks for any help.

 
Did you change the locations of all, i.e any other variables etc.?

For example:
Code:
<script language="JavaScript" src="/jsource.js" type="text/javascript">

would become
Code:
<script language="JavaScript" src="../jsource.js" type="text/javascript">

Hope this helps :)
 
It's not my question, for example I have a simple php file(abc.php):
Code:
<?php 
echo phpinfo(); 
?>
if I have this file in document folder, I can access it without any problem.
(but if I move it to cgi-bin folder:
( it won't work, it just shows blank page.
What cause this issue?
 
Post your php code please.

*cLFlaVA
----------------------------
A polar bear walks into a bar and says, "Can I have a ... beer?"
The bartender asks, "What's with the big pause?
 
At the top of your file, add this line:

Code:
#!/usr/bin/php

If your php executable is somewhere else, use the correct path.
 
If you are running on an ISP's box, generally the cgi-bin is outside of the docs area and cannot run PHP pages as it is usually set up for Perl only. PHP pages ARE docs and ought to be in the docs folder.

Don
contact@pc-homepage.com
Experienced in HTML, Perl, PHP, VBScript, PWS, IIS and Apache and MS-Access, MS-SQL, MySQL databases
 

There are security reasons to run PHP as a CGI script, in which case #!/path/to/phpexecutable should invoke the interpretter on the file as if it were a script. Finding the interpretter is the tricky part, since mine is in /usr/local/apache2/php/bin, you may have to do some hunting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top