0

I've got a few files which cause PHP notices to show if I have them enabled. Everything works as it should, just the notices appear. I know they should be corrected (undefined index and undefined variable) but at the moment I need to get this done. Some pages have over 100, some are as few as 10.

Are there any adverse performance effects to putting this code live, i.e. additional server load?

Charles
  • 50,943
  • 13
  • 104
  • 142
javy
  • 265
  • 1
  • 4
  • 14
  • Obviously there is *some* impact since doing nothing is faster than doing something. But since you know it has to be fixed, what's the point of the question? If perf is not good enough fix it right now, otherwise you can fix it later. – Jon Sep 14 '13 at 11:09
  • Those warnings do not affect performance that much. But you should know, that the only thing that can affect performance is `your code`. – sybear Sep 14 '13 at 11:09
  • Yes they do affect performance, the very act of outputting the notice message is an overhead – Mark Baker Sep 14 '13 at 11:10
  • @Jari, It does affect performance. – Shankar Narayana Damodaran Sep 14 '13 at 11:10
  • @jon http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index if I'm understanding this answer correctly, it implies they can be disabled and forgotten about. – javy Sep 14 '13 at 13:39
  • 1
    @javy: They can be disabled, but they should be fixed, not forgotten. For example, right now I am sitting on a very large and old code base -- it's an application that in its entirety generates *many thousands* of notices. I fix them whenever I touch the code that generates them. – Jon Sep 14 '13 at 16:57

1 Answers1

2

Yes it does affect performance.

You need to fix those issues. As you have clearly mentioned that you have more than 100 notifics. It does cause an overload.

After fixing those, regarding improving the performance, you should also have a look at Alternative PHP Cache which will be useful for you.

There is also a good presentation on APC here on SlideShare.

Shankar Narayana Damodaran
  • 68,075
  • 43
  • 96
  • 126
  • Using PHP 5.5 will remove the need for APC, because the Zend Opcode Cache is integrated. And if I followed the discourse about APC correctly, they still did not release their version for PHP 5.4 as final, it is [still beta](http://stackoverflow.com/questions/9611676/is-apc-compatible-with-php-5-4-or-php-5-5). So the need for APC will go away. – Sven Sep 14 '13 at 11:26
  • `So the need for APC will go away` not for the prior versions of 5.5 right ? – Shankar Narayana Damodaran Sep 14 '13 at 11:29
  • Well, 5.3 has a released version, and 5.4 has a beta version that is supposed to work. Both versions are also supported by Zend OpCache, which has been open-sourced during the integration into PHP 5.5: https://github.com/zendtech/ZendOptimizerPlus – Sven Sep 14 '13 at 11:32
  • 1
    Thanks @ShankarDamodaran, I wasn't sure how severe the issue is, since I see Wordpress plugins with error notices from time to time. Also this answer http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index says disabling notices _is_ an option. Although the security risks mentioned in that answer alone are enough to convince me. – javy Sep 14 '13 at 13:37