ini_set redundancy

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
matt1234
Forum Commoner
Posts: 44
Joined: Wed Nov 26, 2008 9:43 pm

ini_set redundancy

Post by matt1234 »

How far down does an ini_set() go? I have a page that gets included on every page at the top and in it, it has some ini_set() commands. Do would those commands apply to each page below it so I would only need to call that command once? or, for instance, in order to display the errors on each page, do I need ini_set(display_errors) on every one that loads during that time?

And don't say, "Why don't you just put it in the php.ini file if they're all set the same?", cause they're not going to be set the same for each page load. It depends on a variable. Sorry, but too many times I go to ask questions on forums and people are like, "Why don't you just do it this way instead?" which is fine to suggest something, but then they don't answer my question.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: ini_set redundancy

Post by McInfo »

Why don't you just... Just kidding. :wink:

Including files is much like copying the code from the secondary file and pasting it into the primary file. The program state is shared. If you change something in the primary file, the effect will carry over to the secondary file. Likewise, a change in the secondary file will affect the state of the primary file.

If you make a change to the configuration with ini_set(), that change will remain in effect until the end of the script or a subsequent change overrides it. The change is isolated to the current request and does not affect the default configuration.
Post Reply