Is it possible from WebApplication to pass the Session variable to console application, so the console application can add some elements to the $_SESSION that can be accessed latter from the WebApplication?
I guess direct manipulation of the session storage file is hardly the best practice.
In order to get better grasp of the problem imagine the following scenario:
The WebUser start search on the web page. The search results are coming form 20 different sites and each site takes like 30 sec. to produce the results.
So instead of making the user wait for 20 x 30sec = 10min. in order to receive the results, my idea is the WebApplication to start simultaneously 20 console applications that each will fetch the results. This way the total time needed will be 30 sec.
Is there a way the results obtained from each of the console apps to be injected into the session structure of the WebApplication?
This way I hope to avoid some middle layer storage dependencies, like database, filesystem …
you shouldn’t alter users session from outside webapp… it is rather security issue.
I would use cache system instead (you can share cacheid-s and cache storage between webapp and consoleapp) or tool like gearmand (php interface: http://php.net/manual/en/book.gearman.php, there is also some Yii extension for gearmand) which allows you to async execute tasks (on defined pool of runners so you can control total number of working php processes) and then gather results from it when they are ready…
The project is developed by multiple developers and I will have really hard time explaining to them how to install and run gearmand … as I know some of them maybe I will get old before they manage to start it on their development Windows machines.
gearman is a dispatcher of tasks to defined runners. You can use it synchronously or asynchronously. Tasks are of course queued… so it has many applications