473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Forcing Server mode

I've been through the docs and I'm more than a little confused: I'd
like to run [some] PHP apps as ordinary CGI programs. I though/hoped
there'd be a command line switch [that I could put in my shebang line]
that'd tell PHP to run in SERVER mode, but I couldn't find it... Is
there a way to do that?

[meta question: is there a way to get Apache to use mod_php on a
shebang'ed PHP program... that'd be best, of course..:o)]

Thanks! /bernie\

Jul 17 '05 #1
4 1450
On Wed, 27 Apr 2005 14:34:30 -0400, Bernard Cosell <be****@rev.net> wrote:
I've been through the docs and I'm more than a little confused: I'd
like to run [some] PHP apps as ordinary CGI programs. I though/hoped
there'd be a command line switch [that I could put in my shebang line]
that'd tell PHP to run in SERVER mode, but I couldn't find it... Is
there a way to do that?
What is "SERVER mode"?
[meta question: is there a way to get Apache to use mod_php on a
shebang'ed PHP program... that'd be best, of course..:o)]


Don't think so - it'll output the shebang as literal text.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2
Andy Hassall <an**@andyh.co.uk> wrote:

} On Wed, 27 Apr 2005 14:34:30 -0400, Bernard Cosell <be****@rev.net> wrote:
}
} >I've been through the docs and I'm more than a little confused: I'd
} >like to run [some] PHP apps as ordinary CGI programs. I though/hoped
} >there'd be a command line switch [that I could put in my shebang line]
} >that'd tell PHP to run in SERVER mode, but I couldn't find it... Is
} >there a way to do that?
}
} What is "SERVER mode"?

I'm sure I'm getting the terminology wrong: I have a PHP program that when
run *by* Apache works fine, but when I run it directly [either from the
command line or have Apache run it as a CGI program, it won't produce the
HTTP headers. Even with explicit "header" calls in the program, it won't
make a legal HTML/HTTP web page [OTOH, if I put in an explicit "print
"Content-type...etc" it works fine].

There is something afoot that I don't understand about getting PHP to
output the HTTP headers [even when called as a CGI]...
} >[meta question: is there a way to get Apache to use mod_php on a
} >shebang'ed PHP program... that'd be best, of course..:o)]
}
} Don't think so - it'll output the shebang as literal text.

That doesn't seem to be happening for me:

$ cat test.php
#!/usr/bin/php
<html>
<body>
hello
</body>
</html>

$ php test.php
<html>
<body>
hello
</body>
</html>

No 'headers' and such [which is making it REAL hard to debug this PHP/CGI
program I'm working on], but also no shebang line!

/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
be****@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
Jul 17 '05 #3
I think you are confusing the CLI with the CGI. CLI does not output
headers while CGI does. Try php -v to see what you have. And read:

http://php.net/features.commandline

Jul 17 '05 #4
"Philip Olson" <ph*********@gmail.com> wrote:

} I think you are confusing the CLI with the CGI. CLI does not output
} headers while CGI does.

AHA... !THANKS! I was definitely confused, but in an odd way. This page:

} http://php.net/features.commandline

Made clear what's going on for me. It hadn't occurred to me that PHP would
come with two *DIFFERENT* standalone executable options... I assumed that
PHP was just PHP....

Indeed: the sysadmins do have the 'cli' version compiled up, and that means
that I can't (very easily) use PHP for direct-CGI applications [since the
direct-CGI apps will use the executable in /usr/bin, which is the CLI
version] or for debugging my web apps. Too bad that's a compile-time
option instead of a runtime one -- the web server apparently has "mod_php"
hardwired in and that's the only way to get at a "CGI aware" version of PHP
in our environment.

I'm going to get them to update our PHP install [which gives me a little
"say" in how it is configured :o)]... My feeling is that we'll be best
served by having the standalone executable be compiled as the 'CGI' version
-- my primary interest in using PHP is for web stuff -- we have other
tools/languages we can/do use for developing system apps and such...

thanks for clearing up this mini-mystery...

/Bernie\

--
Bernie Cosell Fantasy Farm Fibers
be****@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
Jul 17 '05 #5

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

Similar topics

6
by: Finn Newick | last post by:
By defining a style as follows: @media aural, handheld {td.layout {display:block;}} I'm hoping to linearise layout tables when viewed by screenreaders and handheld devices (it is also be in...
0
by: Henrique Berenguel | last post by:
Hello folks. How do I solve the problem below? when my program executes the line below : Package.WriteXml(Server.MapPath(strID + ".XML")); Ireceive the following error message: ...
6
by: Javier Cortés Cortés | last post by:
i am getting this error when i am trying to access any file(with the ext. aspx) from my remote server. the error is : Server Error in '/' Application....
4
by: tommy | last post by:
hello everbody, i write a little asp-application with forms-authentication. i copy my aspx-files with web.config to my webspace and i get the error above... i tried to set the...
3
by: Sean | last post by:
HI There, I am having trouble deploying my .aspx pages to a remote server, I have made changes to the config file and it still returns an error. I have also contacted the server administrator to...
3
by: Ken | last post by:
When I run my VB.NET application, it loads a large amount of data upon startup. When I checked Task Manager, it showed that roughly 25% +/- of the processor was being used. When I run the same...
2
by: pbd22 | last post by:
Hi. I feel like i should know this but i dont. How do I get the server to send a specific HTTP response to the browser? I want to tell the browser that there is no content coming back from...
4
by: ATS16805 | last post by:
Hi. I wonder if it's possible to "force" a browser to "switch to SSR mode" for any given document. Specifically, I'm looking for a solution, not to a User Agent issue (i think), but a coding idea;...
3
by: Ken Fine | last post by:
I am using ASP.NET's CreateUserWizard control. I want to force the visitor to use a username and e-mail address that I am providing in programming, and I do not want the visitor to be able to edit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.