Re: caching variables and preloading functions
| From: | Greg Beaver | Date: | Sun, 25 May 2003 23:24:53 +0000 |
| Subject: | Re: caching variables and preloading functions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148932@lists.php.net to get a copy of this message | ||
Hello,
in php.ini, make a new line
auto_prepend_file = /path/to/init.php
Problem 2 is slightly more complex. You would have to write a save handler in init.php. Safest would be to save the global variables serialized (see http://www.php.net/serialize) in a database, you can also save them in a file, and load them in init.php. Let me know if you need code examples, or if this is enough to get you started.
Regards,
Greg
--
phpDocumentor
http://www.phpdoc.org
Ssamuel wrote:
Hi, I am looking for a way to do the following with PHP on Apache. 1) I have a list of functions that I would like loaded into memory when the Apache server starts so that other .PHPs can call these functions at any time. Somewhat of a way to expand the API set for PHP. i.e., Say I have a file named "init.php" which has many functions defined. When the Apache server loads, I want this file to be sourced so that these functions are visible to all other phps. 2) I have several variables, that I want to be cached at server init time. These variables are global variables and live until the server is restarted and can be accessed by any .phps. Are there any ways to do these? thanks, sunil.