PHP Classes

Question about compiled language

Recommend this page to a friend!

      PHP Classes blog  >  Top 10 Wrong Ideas Ab...  >  All threads  >  Question about compiled language  >  (Un) Subscribe thread alerts  
Subject:Question about compiled language
Summary:Question about PHP being compiled language
Date:2011-10-13 16:04:33
Update:2011-10-14 05:05:01

  1. Question about compiled language   Reply   Report abuse  
Picture of RamJack RamJack - 2011-10-13 19:31:29
Thank you so much for the great article!!!
Could you please answer the below questions? Thank you so much in advance

1.So does it mean that every time PHP page is requested , it will be compiled and executed or its only once?

2. Language like java are precompiled (JSPs can be precompiled or can be compiled when they are requested for the first time). Isn't it , the additional compile step will result in performance penality?

3. Java/.NET ( requires a deployment but PHP doesn't require a deployment. We can manipulate the PHP without having to compile the files.This looks like a great advantage as we dont need to bring down the server for any deployment. But how about performance?


  2. Re: Question about compiled language   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2011-10-14 01:43:31 - In reply to message 1 from RamJack
By default the Zend engine compiles PHP into Zend opcodes of each script on every request. But if you use a caching extension, it will store the compiled opcode in memory, so the same PHP script does not have to be compiled again because the first time execution compilation results are loaded from memory.

So, there will be a performance penalty if you are not using a PHP opcode caching extension. This may become more noticeable if you have complex scripts that may need to load many classes running by a busy server.

Still keep in mind that sometimes script execute code that takes a lot more time to execute because they do things like database queries, which often take more time run, making the actual PHP compilation time negligible.

  3. Re: Question about compiled language   Reply   Report abuse  
Picture of RamJack RamJack - 2011-10-14 05:05:01 - In reply to message 2 from Manuel Lemos
Thank you so much for the real quick response!!!!!!Great explanation..We will look into opcode cache extension..Thank you again!!!

For more information send a message to info at phpclasses dot org.