473,787 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP as CGI script in CGI-BIN?

All:
I am having problems trying to run some php scripts in cgi. I have Apache 2.0+ and PHP 4.3. Perl works fine
with CGI and PHP works find as an Apache module. Whenever I attempt to run the php script through a URL with the
cgi-bin, it asks if I want to open or download the file. Cgi files execute fine though. Can anyone think of anything I
might be missing in any of the conf files?
Included is an example of one of my php scripts. Thank you for any advice.

#!/usr/bin/php -q

<?php phpinfo(); ?>

Sep 21 '05 #1
2 1796
On Wed, 21 Sep 2005 15:24:05 GMT, cm***********@n ethere.com (Keith) wrote:
All:
I am having problems trying to run some php scripts in cgi. I have Apache 2.0+ and PHP 4.3. Perl works fine
with CGI and PHP works find as an Apache module. Whenever I attempt to run the php script through a URL with the
cgi-bin, it asks if I want to open or download the file. Cgi files execute fine though. Can anyone think of anything I
might be missing in any of the conf files?
Included is an example of one of my php scripts. Thank you for any advice.

#!/usr/bin/php -q

<?php phpinfo(); ?>


The -q flag suppresses the Content-type header, IIRC. You don't want to
suppress this, you want to let PHP send it unless you are specifying one
yourself with header().

Also, make sure the PHP you're referring to is the CGI version of PHP - as
there is a separate command-line version as well (the "CLI" SAPI). Having not
had much experience running as CGI (I always use the webserver module version)
I can't say for sure if these two are fundamentally different, but they
certainly appear to be built separately at least in PHP 5.

What does "php -v" say?
--
Andy Hassall :: an**@andyh.co.u k :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Sep 21 '05 #2
Andy:
I found what the problem was. I was using the php module rather than
the php-cgi module. Thanks!

Keith

Sep 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3302
by: arenaTR | last post by:
I wanted to respost this question becuase I didn't think I was very clear in my earlier post. After doing some db work in a php script, from the same script, i want to call a CGI script with a bunch of strings. I've tried: header("Location: http://mydomain.com/cgi-local/sendemail.cgi?"); To no avail. Following this script is a simple header for an HTML page redirect, which does work. in fact, the cgi call doesn't work at all, but
5
2079
by: el_roachmeister | last post by:
I have a 4000 line php cgi script that is not memory or cpu intensive. It runs in 1 second. Now I am getting a lot of customer requests to add in new features. My question is if there is a point where my code will be too long and take too long to run (i.e > 5 seconds). I would really like to have my script rival the functionality of a desktop application but can php do it? My server is a dual processor with 2GB ram.
2
4902
by: DeepBleu | last post by:
When one is using an HTML form via a web broswer, the user submits the form contents and these are passed to a CGI Python script on the web server. I need to write a client script that connects to a web site, runs a Python CGI script on the web server AND passes a string to the CGI Python script that the Python CGI script can store/manipulate/evalute etc.... I know how to connect to the web site and run the CGI Python script using a client...
2
3213
by: Alex | last post by:
Greetings all, I'm trying to use the "opendir" command on Win32 in a CGI script. I'm using Apache 2.0.48 for Win32. The "openDir" command works from the CGI script when I try to open a folder located on my local system. When I try to "openDir" a network drive using the CGI script run through Apache, Apache gives me the error: Can't openDir... However, when I run the CGI script in a DOS window, the command works properly.
7
1723
by: Amir Michail | last post by:
Hi, Is there an easy way to execute a python cgi script on a different machine from the cgi server? I could write my own server, but I was wondering if something is available that would allow me to use a cgi script as is without modification. Amir
11
3103
by: comp.lang.php | last post by:
On one of my sites, I have a TCL CGI script that has a security hole in spite of it having effective server-side validation (the fact that it's CGI IS its security hole). The front end is a PHP script, and I am writing server-side validation onto it, however, it is required to redirect to the TCL CGI script because only a CGI script has the ability to access a group-accessible XML script on the back end. I had to take the whole thing...
2
1649
TMS
by: TMS | last post by:
I'm using the book Programming Python and I just tried the first CGI script. This is the script: print "Content-Type: text/html\n" print "<TITLE>CGI 101</TITLE>" print "<H1>A First CGI script</H1>" print "<P>Hello, CGI world!</P> And this is what it looks like when I open my browser (er... IE), and look at it:
51
4162
by: Ojas | last post by:
Hi!, I just out of curiosity want to know how top detect the client side application under which the script is getting run. I mean to ask the how to know whether the script is running under Command Prompt or Browser or some other application? Ojas.
14
5413
by: asdf | last post by:
I have a python script whose output i want to dynamically display on a webpage which will be hosted using Apache. How do I do that? thanks
3
1365
by: jain236 | last post by:
Hi every body, i am just new to the CGI scripting. i am trying to run a basic CGI script . i am using APACHE as my web server . i have placed my basic script inven.cgi in the web server and when i am trying to access my script with http://mydomain/inven.cgi instead of getting the functionality of the script , i am seeing the whole script code on the web page.Do i need to do any setting to run the CGI script? here is the code which i...
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.