php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #11815 ASP/ColdFusion Application type freature
Submitted: 2001-06-30 20:00 UTC Modified: 2004-04-08 12:38 UTC
From: jocke at selincite dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.6 OS: all
Private report: No CVE-ID: None
 [2001-06-30 20:00 UTC] jocke at selincite dot com
I'd like PHP to have a feature that behaves similar to ASPs Application (global.asa) file.

For example if I want to store the sitemap in a database to generate a navigation menu it's unneccessary to query the database upon every request, instead I'd like to store that informatoin in a "php-application-wide" storage
(Maybe $PHP_APPLICATION_VARS[] array).

I can see it could behave similar to the session functions. When session functions are shared between requests, the application is shared between requests.

To do this, you could start an application with:
application_start("name");

I've not been thinking much about security, but I reckon it should not be possible to hijack an application, therefore there needs to be a (filebased) system that determines which files can be within an application. Maybe with a path? like:

application_start("name", "/path/to/where/my/files/are");
which means that all files have to be within that folder or in it.

There should also be a way to determine if the application is started or not, this to run the code upon start. Like;

if(!application_exsists("name")) {
// This code is being run when the application starts
application_start("name", "/path/to/files/");
}

This would reduce server load and eliminate "hacks" in this area.

Comments?

Cheers,

/Jocke Selin - jocke.selincite.com / jocke@selincite.com

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-01 03:18 UTC] joey@php.net
I'm closing this because I'm pretty sure you can get
what you are looking for by combining the php.ini
setting "auto_prepend_file" with session support.

If you decide after research that this really isn't
what you want after all, perhaps you could file a more
detailed Feature Request.
 [2004-04-08 12:27 UTC] kevin at webpowerservices dot co dot uk
As with Jocke, Application scoped variables are the only thing so far that I see that PHP does not handle. Using sessions and auto_prepend_file is not a good solution. For example many sites run several identical components within pages that are each initially looked up from a database. Using asp these can be stored once only for those that do not change between page calls within fixed memory, using application variables. This you can only do efficiently using one area of memory that stays fixed for all users until server is rebooted or you explicitly overwrite these values. Using sessions won't work if you have lots of concurrent connections since your resources will run out. With application variables the same memory location is used for all so a component based site will always scale very well. But to do this using sessions will not scale if you are storing identical components.  Each user with a session would hold their own copies of these components in memory which if they are identical should only really be held in one memory location. To do anything like this with session variables is very inefficient. Also using hidden include type files for large numbers of components is not a good solution and is a very cluncky. ASP have got this one sorted over PHP, hopefully this situation will soon change. I am sure it will. It needs some kind of memory manager application wide. I bet someone out their is writing it allready. If any one is developing one, I would really like to get in touch with them.
 [2004-04-08 12:38 UTC] tony2001@php.net
take a look at SRM (http://www.vl-srm.net)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 19:01:28 2024 UTC