<p>I know PHP scripts don't actually compile until they are run. However, say I want to create a small simple program and compile it to a binary without requiring the PHP binary. How could I do this?</p>

<p>I've seen a few IDE's out there that would do this, but either they are all for windows or the Linux versions don't actually build properly.<br>
What I would like is something like py2exe that does it in the script itself.</p>

[{'answer_id': 48264, 'author': 'UnkwnTech', 'author_id': 115, 'author_profile': 'https://Stackoverflow.com/users/115', 'pm_score': 2, 'selected': False, 'text': '<p>There is this: <a href="http://www.bambalam.se/bamcompile/" rel="nofollow noreferrer">http://www.bambalam.se/bamcompile/</a> but that compiles to Windows bytecode.  There are a few others, but all I have seen will compile for windows only.<br /><br />Few More:\n<br /><a href="http://www.nusphere.com/products/phpdock.htm" rel="nofollow noreferrer">http://www.nusphere.com/products/phpdock.htm</a></p>\n\n<p>Edit: I almost forgot if your looking to make it work on linux without regard for windows you can just add </p>\n\n<pre><code>#!/usr/bin/php\n</code></pre>\n\n<p>to the top of the script and you should be able to run it from the command line.  Don\'t forget to chmod +x the file first.</p>\n'}, {'answer_id': 48389, 'author': 'Chris Bartow', 'author_id': 497, 'author_profile': 'https://Stackoverflow.com/users/497', 'pm_score': 4, 'selected': True, 'text': '<p>Check out <a href="https://github.com/pbiggar/phc" rel="nofollow noreferrer">phc: the PHP compiler</a></p>\n<p>If you just want to run it like a script, you may not need to compile it per se, but just run it via the command line.  <a href="http://www.php.net/features.commandline" rel="nofollow noreferrer">Read running PHP via the command line.</a></p>\n'}, {'answer_id': 2887421, 'author': 'Ivy Evans', 'author_id': 304920, 'author_profile': 'https://Stackoverflow.com/users/304920', 'pm_score': 0, 'selected': False, 'text': '<p>Have a look at Facebook\'s <a href="http://github.com/facebook/hiphop-php#readme" rel="nofollow noreferrer">Hiphop-PHP</a>. It\'s able to convert PHP code into C++ then compile it with g++. Apparently, they\'ve even gotten it to successfully compile entire WordPress installations.</p>\n'}]
['https://Stackoverflow.com/questions/48253', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4985/']