|
Posted by Schraalhans Keukenmeester on 05/12/07 18:00
At Sat, 12 May 2007 11:26:47 -0400, -Lost let his monkeys type:
> -Lost wrote:
>> Schraalhans Keukenmeester wrote:
>>> I am considering using the php 'auto_prepend_file' directive to have a
>>> few default things loaded and some superglobals unset for all customers
>>> using my server. The intended file does not produce any output to the
>>> browser, just sets a few variables, modifies/unsets a few server &
>>> environment variables, defines a few constants and loads a custom ftp
>>> class definition.
>>>
>>> It seems temptingly easy to do so, but I would like to have some insight
>>> in what can of worms I may be opening going this route. Are there strong
>>> arguments pro/against using this feature? Some great examples perhaps?
>>
>> Remember that it mimics include(), so include_path is what is used.
>>
>> Other than that, I see nothing wrong with it. Assuming your code does
>> not expose any information, and your server is setup to properly deliver
>> the content. As in, PHP is delivered as PHP.
>
> Oh, and don't use exit().
I think I've read somewhere exit() only has implications for
auto_APpend_file, not for its prepend counterpart. But undoubtedly you
know more about it. Glad to hear!
I also read -as you stated- it handles the file as an include, which may
lead to problems if the file is specifically included later, or a
function definition is repeated later on.
One advantage is I can prepend stuff completely outside the docroot AND
include_path, so no script could ever re-include it. The php include_path
doesn't limit this feature, at least not in my setup. It takes an absolute
or relative filepath (relative to the php.ini dir).
Then there are quite a few reported bugs, but I haven't seen chance yet to
inspect all these reports, some of which from the google synopsis alone
can be filed under 'User Error'.
I'll test it first, see how well it works, if there are many hickups or
unexplained/unexpected behaviours involved.
Thanks for your comments!
Sh.
[Back to original message]
|