tags:

views:

712

answers:

3

Is it possible to convert a PHP file to binary and deploy it on a webserver..........

+4  A: 

Since PHP is a (relatively)portable language, compiling PHP source to bytecode instead of binary code is more preferable. For this purpose there is an experimental project called bcompiler. You may also interested in phpc.

eyazici
Thanks.........................
Hulk
There is also roadsend, which (I think) is using parts of phpc after they abandoned scheme.
Tim Post
phc is kind of a pain to install, and roadsend seems to be slower than running files through the php interpreter.
Brendan Long
A: 

It depends on what you mean by "binary".

If you want to compile (or just obfuscate) your PHP code to keep someone else from modifying then use a bytecode compiler. One example are the tools from Zend, among others. (I prefer Zend's tools because they the primary company behind PHP and fully QA all their tools against all the versions of PHP).

If you want to compile your PHP code and link the PHP runtime to it and then deploy it (like C\C++), then no. Maybe in theory that would be possible but it would be a mess. (Not practical or feasible and don't think anyone has put anything together to try and the output would also be tied to a particular architecture).

Zac Bowling
Thanks.........................
Hulk
About ...................... too many dots.
Garrett
A: 

Hi, If the web server is Linux based, you can create a package like .deb or .rpm (depending on the Linux distribution) and easily distribute/deploy it.

BR, Dawid.

Czlowiekwidmo
Have you ever read the question?
eyazici
It's not a bad answer. The question seems to be asking "How do I convert php files into a distributable program".
Brendan Long
Convert a PHP file into a binary is not the same converting a PHP file into a distributable program.
eyazici
Well obviously the question is not that clear. But it seems that he needs a servlet like approach.
JCasso