|
Posted by Jerry Stuckle on 05/13/07 02:57
-Lost wrote:
> Jerry Stuckle 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?
>>>
> > I wouldn't.
>>
>> Environment variables for all users should be set before Apache
>> starts. Then they'll all be available. And which superglobals are
>> you referring to? I'd get fairly upset if one of the superglobals I
>> need is missing. Same with server variables.
>>
>> As for variables - what would be the purpose? And what if one of the
>> scripts I use happens to use those same variables? Or a class with
>> the same name as your custom ftp class? There's a reason most hosts
>> don't do this - it can screw up someone's scripts.
>>
>> Also, you're forcing the parser to parse more code for every PHP
>> script out there - whether it's needed or not.
>>
>> Just set everything up in your Apache start script and let it run.
>> And if you want to give them access to your custom FTP class, let them
>> have it.
>
> These are all really good points.
>
> I would add then, that I would still use this method, but on a
> per-application basis. You could use it with .htaccess, and apply only
> to the directories needed.
>
> Especially if you know what should or should not be going on for a user
> at the start of a certain area. For example, upon login. Then again,
> one might wonder why you would bother if it was only needed in the login
> script.
>
> It is still a smart, and viable option. Just not in the examples you
> quoted above.
>
> Surprisingly, most examples I found on the subject never discussed their
> use (auto_prepend_file and auto_append_file) as automatic header and
> footer inserts.
>
Probably because not many people are doing it due to the potential problems.
Some free hosting services will use prepend and append files (html
and/or php) on their free sites to place ads. But that's about all.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|