Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 733957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:18:59+00:00 2026-05-14T07:18:59+00:00

In my mind, a web app something that runs continuously; therefore, I’m confused by

  • 0

In my mind, a web app something that runs continuously; therefore, I’m confused by documentation pages that talk about the “end” of a PHP script (eg this one). Such references seem to refer to the end of each web request, but if the script ends there, doesn’t that mean that the OS has to setup a whole new process for each request? That seems unlikely, because spinning up a whole new process is expensive, and be very inefficient for the whole site.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:18:59+00:00Added an answer on May 14, 2026 at 7:18 am

    There’s a distinction to make here: PHP is not a web server. Therefore, the end of a PHP script is irrelevant to the actual end of the web server (or at least, most of the time).

    Web server software that continuously run, like IIS, Apache or Lighttpd can execute PHP scripts without ending themselves. These scripts, at the end, do cease to run. How web servers set up the execution environment for the script depends on the approaches taken. For instance, Apache 2 can indeed spawn a child process for each web request, though it does not set up again the whole web server each time: there’s a master process that commands the children about execution settings and parameters.

    Therefore, a PHP script ends when the web request ends; that is, when the script reaches a statement that makes it stop (like a fatal error, an exit statement or the like) or when it reaches the actual end of the script source.


    EDIT About the efficiency of spawning a new process for new requests.

    Nowadays, servers don’t spawn a separate process for PHP itself: they use the PHP library to embed the language and work with it. However, servers are indeed free to spawn a process for every HTTP request they receive. Apache does it with its mpm_prefork module.

    While spawning a new process is indeed expensive, it’s potentially nothing when compared to the cost of the script itself, which can last tenths of seconds, which is much, much more than just spawning a process.

    Also, servers usually have to serve many clients at once; therefore, it is unthinkable to just treat every request sequentially. They must be run concurrently, and that leaves implementors two options: threads or processes. PHP not being thread-safe on many platforms, it is often preferable to run it in a separate process.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web app in production that is used for typical data entry,retrieval,
I have a data entry web app where the control that has focus is
I have an approach in mind for an image viewer in a web app,
We are a new startup that is going to develop a web app for
Keep in mind that I'm not looking for a list of current browsers to
Bearing in mind that I'll be performing calculations on lat / long pairs, what
I would like to add in my web app ability to add comments to
If I want to work on a web app with 2-3 months of timeframe
We (a group of 4 students) are planning to create a web-app on Ruby
I got a project in mind that makes it worth to finally take the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.