
08-14-2007, 08:42 AM
|
| D-Web Trainee | | Join Date: Feb 2007
Posts: 25
| |
Re: Website Performance - Tips & Tricks Better php.ini setting (track_vars, register_globals) PHP users are better to set enable "track_vars" and disable "register_globals" for sevral reasons.
(PHP programmers are better to use $HTTP_*_VARS and $HTTP_POST_FILES).
1) Readability: With $HTTP_*_VARS, code readers does not have to check where values comes from. With $HTTP_*_VARS, code maintenance can be much easier and programmer will spend less time for debugging code.
2) Portability: If global var registration order has been changed (May differ server to server), code may not be portable. (Insecure also)
With PHP4, track vars are always enabled, so programmer can be sure there are $HTTP_*_VARS for PHP4.
3) Security: Without $HTTP_*_VARS, sensitive variables may be over written by intruders. Or sensitive variables may be over written due to changes in global var registration order. [Programmer should check user inputs always, thogh]
4) Performance: If "register_globals" is disabled, PHP does not have to make a copy for global var. Programmer does not have to check to make sure variables are over written unintentionally.
5) PHP4 Session: Programmers can save session variables without using session_register() with $HTTP_SESSION_VARS. i.e. Programmer can use $HTTP_SESSION_VARS as normal array and it persists as session vars
PHP users could have these benefits by using $HTTP_*_VARS. Without $HTTP_*_VARS, programmers are loosening those advantages in return of saving number of typing keys. Thanks -Kathir |