Can I run a PHP file from the cgi-bin?
Category: How To
Have a question?
Ask the Community!

Question Asked by SteveC

Can I run a PHP file from the cgi-bin?

Resolved Question
How do I point to my cgi library from HTML pages? For example, I have this code:

var client = new XMLHttpRequest();
client.open("POST", "/SCOMSTO/logger.php", true);

and it works on another server because there is a mapping directive that maps /SCOMSTO/* to /u/scomsto/cgi-bin/*


Similarly, in another HTML page I have:

  • Asked 2012-02-09 16:35
  • Hits: 2193
  • Closed on: 2012-02-09 16:23

Best Answer Chosen by SteveC

Vote
0
0
0
Hi SteveC,

Thanks for posting your question. I'm more than happy to assist you today. If you are on a VPS or Dedicated hosting plan you can contact our support department to have a symlink set up.

If you are on a shared hosting package, you'll need to store the cgi scripts in the cgi-bin folder in the public_html folder. Then you'll need to update your path in your code to reflect the path to the cgi-bin. If the HTML page calling the script is in the public_html folder, the path would be:

var client = new XMLHttpRequest();
client.open("POST", "/cgi-bin/logger.php", true);



I hope this helps! If you need further assistance please feel free to contact us.

Thanks!

Tim S
2012-02-09 16:43

No other Answers Submitted


Rating:
 
Please log in to rate this question.
Like this Question?

Comments

Comments 

 
0 #3 SteveC 2012-02-09 16:23
Never mind. I got it working. Not sure how, but I'll take it. Thanks again.
 
 
0 #2 Tim S. 2012-02-09 16:22
Hi SteveC,

My apologies, you cannot run PHP scripts form the cgi-bin. I copied your script over to your public_html folder and ran it from a web browser to see if it would execute and it appears to create "thelog" file as it should.

You can run the script from any folder in the public_html folder other than the cgi-bin and it should be fine.

If you need further assistance please feel free to contact us.

Thanks!

Tim S
 
 
0 #1 SteveC 2012-02-09 16:13
Tim,

Thanks for the rapid response. I gave it a try and nothing is happening. I see my CGI in public_html/cgi-bin:

logger.php with permissions 744, but it doesn't seem to be working. I judge that by the fact that the file that is to be created, 'thelog', is not visible in either the cgi-bin nor the public_html directories.
 

You must log in before commenting.

Need more Help?

Search
Current Customers
Chat:Click to Chat Now
Call:888-321-HOST (4678)
E-mail:support@InMotionHosting.com
Ticket Submit a Support Ticket
Need more How To help?
Try browsing the standard How To category page in our Knowledge Base.
Not a Customer?
Get web hosting from a company that is here to help. Sign up today!

Follow InMotion Hosting!

 4236 Followers. Follow Us!