473,698 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1465
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.andyhsoftwa re.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****@fantasyf arm.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*********@gm ail.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****@fantasyf arm.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
7722
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 some selectable user preferences). This works as intended in Netscape 7 - all the cells stack vertically above each other nicely, but not in Internet Explorer 6 where the only display property that td will respond to seems to be 'none'.
0
5476
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: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.UnauthorizedAccessException: Access to the path
6
635
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. ---------------------------------------------------------------------------- ---- Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application
4
5388
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 custom-errors-tag ="off" but nothing happens.... what is my failure????
3
375
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 create an application in IIS, what other checks can I make? Sean !-- error mesage
3
1637
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 program on an XP desktop, processor usage goes to 100% until all of the data is loaded. I checked the WSRM (Windows System Resource Manager) and the program is not being limited in it's processor or memory usage. Can anyone tell me why this occurs?...
2
1276
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 ther server and I want to do it in the HTTP Headers. The status code is "204" for no content.
4
3664
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; a programming "what if..?". i'm not concerned w/ manipulating a browser (i.e. prefs., settings this URL, always view SSR, save), but rather something i would code into the document which would request the browser to display in this mode (i.e....
3
2591
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 the forms input. I am aware that I can roll my own Create User form by using the membership API, but I am lazy and want to use most of the CreateUserWizard control's features. I tried converting the form to a template and setting the UserName...
0
8600
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,...
0
9155
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9018
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8890
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
8858
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7711
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
6517
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
5859
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
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.