Why compile a PHP File?

Francesco picture Francesco · May 5, 2011 · Viewed 8.6k times · Source

A friend of mine told me recently "to optimize your site you may want compile your php files" and i was like "what?"

I honestly i never heard of that, i'm a "advanced-naive" programmer, that means i'm self taught, i built complex sites but i'm still missing something...

Bottom line:

what does it mean compile php? convert them in exe files? why? is faster?

Answer

JimmyBlu picture JimmyBlu · May 5, 2011

While PHP code needs to be interpreted on every call, bytecode is precompiled code that runs almost instantly. Mostly you will only really need it, if you are running a larger website.

The following tools can be used to compile scripts or run compiled scripts: