Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How to use php script in cgi-bin directory
Old 09-22-2004, 02:22 AM How to use php script in cgi-bin directory
bre
Junior Talker

Posts: 2
Trades: 0
Got two php scripts in a subdirectory in cgi-bin. First is a form. Second just displays the input field from the form. These work fine outside cgi-bin directory, but form variable is not passed when run in cgi-bin directory. Banging my head against wall on this. Scripts are below. Permissions are 755 for each script. Scripts don't work at all in cgi-bin unless first line is in script.

#!/usr/local/bin/php

So here's the code for 1st script which shows form.

Code:
#!/usr/local/bin/php
Content-type: text/html

<HTML><HEAD><TITLE> *** Put a title HERE ***</TITLE>

</HEAD>
<BODY BGCOLOR=white>
<form action="http://mysite.com/cgi-bin/ubb6/Members/show_regdate.php" method="post"> 
Enter reg date mm-dd-yyyy: <input type="text" name="regdate" value="" size=10>
<INPUT TYPE="SUBMIT" VALUE="Submit"> 
</form>
<?php
//comment
?>
</BODY>
</HTML>
I enter 09-26-2004 in box and it runs 2nd script

Code:
#!/usr/local/bin/php
Content-type: text/html

<HTML><HEAD><TITLE> *** Put a title HERE ***</TITLE>

</HEAD>
<BODY BGCOLOR=white>
<?php
$regdate = $_POST['regdate']; //add this line

echo "<p>-- Registration date is : $regdate --";
?>
</BODY>
</HTML
Output is: -- Registration date is : --

When I run this outside cgi-bin, I get this output: -- Registration date is : 09-26-2004 --

Any clues on why this won't work in cgi-bin?
bre is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-22-2004, 05:42 PM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
Trades: 0
bre,

I can't exactly answer your question, but I will say that there is nothing wrong with your code. I reviewed it and it is fine. The fact that your code works outside the directory confirms that.

Don't some web servers treat files in cgi-bin differently? Could this be affecting the server's ability (or willingness) to submit it to the PHP scripting engine for processing?
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Old 09-24-2004, 03:04 PM
bre
Junior Talker

Posts: 2
Trades: 0
Yes they obviously do since script works outside. Don't know much about it though. I saw someplace that you need global registers (or something like that) set to on. My host tells me they're off. I am going to try to get them to set it for me. They won't do it with shared hosting but since i have a dedicated server plan with them, there shouldn't be any reason not to set it for me. We'll see if that works.
bre is offline
Reply With Quote
View Public Profile
 
Old 01-29-2011, 06:30 AM Re: How to use php script in cgi-bin directory
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
cgi-bin is indeed a special directory. The simplest thing to do is move the scripts! Re REGISTER_GLOBALS, have a read of http://php.net/manual/en/security.globals.php before you decide you really want it ON.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to use php script in cgi-bin directory
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24599 seconds with 12 queries