setting up php environment

Posted on 2009-02-16
Last Modified: 2013-12-25
what is the difference on setting up php environment as CGI or as a module to a web server
Question by:gmeltsin1
    LVL 4

    Accepted Solution

    Quoted from

    "CGI is just an interface to execute a program. When you use php this way, the web server starts up the php binary and feeds it the php script (more or less...). PHP starts up, parses the file, returns the static html output and then shuts down.

    With the module, php is no longer a seperate program. It is linked with apache so that apache and php run together as a single program. This way, when the webserver get's a request for the script, apache interperates it natively. Saves the high overhead of starting and killing the interperator each time."

    You can read some more in these:

    Hope it helps
    LVL 39

    Expert Comment

    As a seperate program, apache will start the php binary program, and tell it what script to run.  Apache will provide it some information (the CGI environment).  The php program will write to standard ouput the output from the script.  Apache will take that output, and send it to the client (eg: web browser).

    As a module, the php interpreter behaves like a function that apache can call.  When used like this, the main php interpreter is loaded into memory once, and the processing of the php scripts happens inside the module.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now