Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to wrap PHP/MySQL application in binary that can work as stand alone application?

I have my application written on PHP/MYSQL. We are looking at option for deployment at client site machine. What is the option and how to do it? Apart from that we are more concern about protecting our code. Hence, we're looking at the option that can make a binary application for our web application developed on php/mysql.

Apart from that is there any installer available that can extract and install php/apache/mysql stack ?

like image 599
Krunal Avatar asked Feb 16 '12 10:02

Krunal


People also ask

Can PHP stand alone?

You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks.

Can you compile PHP?

phc allows you to compile PHP programs into shared libraries, which can be uploaded to the server. The PHP program is compiled into binaries.


2 Answers

See this previous response to a similar question for a comprehensive list of the options available for compiling/wrapping PHP code as an executable for Windows

Other options available for non-Windows:

HPHP (Facebook's HipHop)

https://github.com/facebook/hiphop-php/wiki/

https://github.com/facebook/hiphop-php

HipHop for PHP is a source code transformer for PHP script code. HipHop programmatically transforms PHP source code into highly optimized C++ and then uses g++ to compile it to machine code. HipHop includes a code transformer, a reimplementation of PHP's runtime system, and a rewrite of many common PHP Extensions to take advantage of these performance optimizations. HipHop was created by Facebook to save resources on its servers. It is being distributed with its over 300,000 lines of source code written in C++ and C as free software under the terms of version 3.01 of the PHP License. Facebook has also developed HPHPi, which is an experimental interpreter designed for development with no need to compile the PHP source code before running it.

Roadsend and Roadsend Raven

http://www.roadsend.com/home/index.php

https://github.com/weyrick/roadsend-php/wiki

https://github.com/weyrick/roadsend-php

Roadsend PHP is an open source implementation of the PHP language. It compiles PHP source code to stand alone, native binaries which do not require an interpreter. Roadsend Compiler can build online web applications with Fast/CGI, offline web applications with an embedded web server (!MicroServer), desktop GUI applications with PHP-GTK, and console applications. It is known to build on Linux, Windows (using mingw), Mac OSX, and FreeBSD.

Roadsend Compiler also contains facilities for interpreting, profiling and step debugging PHP code.

Roadsend PHP is a completely independent implementation of the PHP language and runtime environment, and is not based on the original implementation (using the Zend engine) which is separately and freely available at http://www.php.net. Zend PHP is not required, and is not used in any way, by Roadsend PHP.

Last change to the roadsend code was 17 months ago (a patch for Ubuntu 10.04 llvm package), prior to that was 21 months ago. Readme's have been updated in the last two weeks (at time of writing this) so perhaps it's about to be resurrected again. Can build Linux executables

Phalanger

http://www.php-compiler.net/

http://wiki.php-compiler.net/Phalanger_Wiki

http://phalanger.codeplex.com/

Phalanger is a project which was started at Charles University in Prague and was supported by Microsoft. It compiles source code written in the PHP scripting language into CIL (Common Intermediate Language) byte-code. It handles the beginning of a compiling process which is completed by the JIT compiler component of the .NET Framework. It does not address native code generation nor optimization. Its purpose is to compile PHP scripts into .NET assemblies, logical units containing CIL code and meta-data.

phc

http://www.phpcompiler.org/

phc is an open source compiler for PHP with support for plugins. In addition, it can be used to pretty-print or obfuscate PHP code, as a framework for developing applications that process PHP scripts, or to convert PHP into XML and back, enabling processing of PHP scripts using XML tools.

phc for PHP programmers (See Manual):

  • Compile PHP source into an (optimized) executable (supports entire PHP standard library).
  • Compile a web application into an (optimized) extension (supports entire PHP standard library).
  • Obfuscate PHP code (--obfuscate flag - experimental). Combine many php scripts into a single file (--include flag - experimental).

Last change to the phc code was on 18th December, so sill actively ongoing development. Can build Linux executables Can be used to build C code, with appropriate PHP "macros" for extensions

ROSE Compiler

http://rosecompiler.org/

Dependent on phc compiler for working with PHP

like image 160
Mark Baker Avatar answered Sep 28 '22 08:09

Mark Baker


Look at PHP obfuscators, examples:

http://www.seocompany.ca/software/free-encryption-software.html

https://stackoverflow.com/questions/908678/is-there-any-good-php-obfuscator

Obfuscators aren't 100% but they are easy to implement and the output is pretty gnarly.

like image 42
MarkR Avatar answered Sep 28 '22 08:09

MarkR