I 开发者_如何学Chave a need to start the Apache service with a parameter so that I can later access that parameter via PHP. Is this possible?
pass the parameter to httpd with the -C or -c (process the configuration directive before/after reading config files) command line option and the SetEnv directive:
httpd -C "SetEnv FOO bar"
FOO can now be accessed from PHP like so:
<?php
print getenv('FOO');
prints
bar
You can set an environment variable. See also: getenv
Based on the comments on your question, I'd say that using shared memory is an acceptable alternative. Take a look at shmop_open() et alia.
the httpd program will take a 'directive' when you start it up using -c, so experiment with that and SetEnv.
加载中,请稍侯......
精彩评论