2

I am from Java EE background and learning PHP, so please advise me accordingly.

Does PHP tries to interpret the code every time it is requested? Or is there any modificationTestInterval of JSP? I am using PHP 5.4 with httpd on CentOS 5. It has Zend included. Does it do opcode caching automatically?

Please suggest optimization techniques if my code is not going to change frequently.

4
  • 2
    try to google about php accelerators (APC, eAccelerator, XCache, etc) Commented Aug 3, 2012 at 7:08
  • You code include just php language? or is web app with html, js, php...? For PHP, +1 CyberDemOn, PHP accelerator was ideal. Else, it's a website, you can read this post, for optimize all part of your web Application Commented Aug 3, 2012 at 7:32
  • its PHP on server side spitting out html only. Almost no javascript or ajax as it is mobile site for feature phones. Commented Aug 3, 2012 at 8:49
  • You would typically use APC as suggested in one of the answers below. APC is both an (automatic) opcode cache and a user-cache. You can use it to cache your own stuff too, in between / across requests. Commented Aug 4, 2012 at 13:08

1 Answer 1

2

Does PHP tries to interpret the code every time it is requested ?

Theoretically yes, but at least in production you will use a bytecode cache (like APC) usually.

It has Zend included. Does it do opcode caching automatically ?

You can find it out with the builtin-function phpinfo(). If there appears apc, or xcache, then it's enabled. Else you need to enable it first. You should be able to refer their manual for this step.

Sign up to request clarification or add additional context in comments.

2 Comments

Zend Memory Manager is enabled but I cant see apc or xcache. When I am making changes in PHP file, they are getting reflected immediately. This seems to indicate that opcode caching is not enabled. Will there be significant performance improvement if that is enabled ?
Zend Memory Manager is not an opcode cache, but .. yeah, a memory manager ;) However, that the changes takes effect immediately is not a hint, wether you have an opcode cache, or not, because by default every opcode cache checks, wether files have changes, or not (for example by tracking the modification time). You can disable this feature for further improvements, but remember, that you must clean your file (/system) cache by hand after every deployment (it's not that hard). At all: Seems, that you don't have a bytecode cache installed and enabled yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.