Reply to Re: Auto_prepend_file

Your name:

Reply:


Posted by -Lost on 05/12/07 19:39

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.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация