I've this PHP application whose startup is really complicated. I'm inspired from how nodejs works (the application is live and serves clients without load and unload like PHP).
For each request, apache loads the script, instantiate classes and objects (I've so many of them hence startup is resource intensive) and executes it, then unloads it (what a waste), and repeats the same process for the next request.
In Nodejs the script is loaded into memory for the entire session, and code is executed from start to end for each request, there's no loading of script for each request and no unloading at the end of the request.
Is it possible to accomplish the same using linux daemon. I'll be deploying it on AWS Elasticbeanstalk.
Example PHP code
<?php
echo "Hello " . $_SERVER["REMOTE_ADDR"];
//followed by a series of instantiation of several classes and objects at startup
//would like to have them instantiated only once, keep in memory and then executed
//based on the URL onwards from there
//just like how nodejs works
?>