IT박스

PHP 스크립트를 독립형 Windows 실행 파일로 변환

itboxs 2020. 7. 10. 08:10
반응형

PHP 스크립트를 독립형 Windows 실행 파일로 변환


상당히 간단한 작업을 자동화하고 싶습니다. 이를 위해 PHP-CLI를 사용하여 명령 행에서 실행하는 작은 PHP 스크립트를 작성했습니다. 이제이 스크립트를 누군가에게 넘겨주고 싶지만 :

  • 소스 코드를 제공
  • 시스템에 PHP를 설치하도록 요청하십시오

PHP 스크립트의 .exe 버전을 만드는 방법이 있습니까? 디 컴파일에 대해 크게 걱정하지 않습니다. 사람들에게 PHP를 설치하고 구성하도록 요청하는 것이 더 걱정됩니다.


복숭아 파이

http://www.peachpie.io

https://github.com/iolevel/peachpie

Peachpie는 Microsoft의 Roslyn 기반 PHP 7 컴파일러이며 인기있는 Phalanger에서 추출한 것입니다. PHP 코드를 순수 MSIL로 컴파일하여 .NET / .NETCore 내에서 PHP를 실행할 수 있습니다.

팔랑 게르

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

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

https://github.com/devsense/phalanger

Phalanger는 프라하의 Charles University에서 시작되어 Microsoft의 지원을받는 프로젝트입니다. PHP 스크립트 언어로 작성된 소스 코드를 CIL (Common Intermediate Language) 바이트 코드로 컴파일합니다. .NET Framework의 JIT 컴파일러 구성 요소에 의해 완료되는 컴파일 프로세스의 시작을 처리합니다. 네이티브 코드 생성이나 최적화는 다루지 않습니다. 그 목적은 PHP 스크립트를 .NET 어셈블리, CIL 코드 및 메타 데이터를 포함하는 논리 단위로 컴파일하는 것입니다.

밤 발람

https://github.com/xZero707/Bamcompile/

Bambalam PHP EXE Compiler / Embedder는 PHP 응용 프로그램을 독립형 Windows .exe 응용 프로그램으로 변환하는 무료 명령 줄 도구입니다. 생성 된 exe 파일은 완전히 독립형이며 PHP dll 등이 필요하지 않습니다. PHP 코드는 Turck MMCache Encode 라이브러리를 사용하여 인코딩되므로 소스 코드를 보호하면서 애플리케이션을 배포하려는 경우 완벽한 솔루션입니다. 이 변환기는 윈도우 PHP 응용 프로그램 (예 : WinBinder 라이브러리를 사용하여 생성)을위한 .exe 파일을 생성하는 데 적합합니다. 또한 독립형 PHP 소켓 서버 / 클라이언트 (php_sockets.dll 확장명 사용)를 만드는 데 좋습니다. PHP 소스에서 네이티브 머신 코드를 생성하지 않는다는 점에서 실제로 컴파일러는 아니지만 작동합니다!

ZZEE PHPExe

http://www.zzee.com/phpexe/

ZZEE PHPExe는 PHP, HTML, Javascript, Flash 및 기타 웹 파일을 Windows GUI exe로 컴파일합니다. 익숙한 PHP 웹 패러다임을 사용하여 Windows GUI 응용 프로그램을 빠르게 개발할 수 있습니다. 거의 또는 전혀 수정하지 않고 온라인 및 Windows 응용 프로그램에 동일한 코드를 사용할 수 있습니다. 상용 제품입니다.

phc-win

http://wiki.swiftlytilting.com/Phc-win

PHP 확장 bcompiler는 PHP 스크립트 코드를 PHP 바이트 코드로 컴파일하는 데 사용됩니다. 이 바이트 코드는 bcompiler 확장이로드되는 한 모든 PHP 파일과 마찬가지로 포함될 수 있습니다. 모든 바이트 코드 파일이 생성되면 수정 된 Embeder를 사용하여 모든 프로젝트 파일을 프로그램 exe에 압축합니다.

필요

  • php5ts.dll
  • php_win32std.dll
  • php_bcompiler.dll
  • php-embed.ini

ExeOutput

http://www.exeoutput.com/

상업용

WinBinder

http://winbinder.org/

WinBinder is an open source extension to PHP, the script programming language. It allows PHP programmers to easily build native Windows applications, producing quick and rewarding results with minimum effort. Even short scripts with a few dozen lines can generate a useful program, thanks to the power and flexibility of PHP.

PHPDesktop

https://github.com/cztomczak/phpdesktop

PHP Desktop is an open source project founded by Czarek Tomczak in 2012 to provide a way for developing native desktop applications using web technologies such as PHP, HTML5, JavaScript & SQLite. This project is more than just a PHP to EXE compiler, it embeds a web-browser (Internet Explorer or Chrome embedded), a Mongoose web-server and a PHP interpreter. The development workflow you are used to remains the same, the step of turning an existing website into a desktop application is basically a matter of copying it to "www/" directory. Using SQLite database is optional, you could embed mysql/postgresql database in application's installer.

PHP Nightrain

https://github.com/kjellberg/nightrain

Using PHP Nightrain you will be able to deploy and run HTML, CSS, JavaScript and PHP web applications as a native desktop application on Windows, Mac and the Linux operating systems. Popular PHP Frameworks (e.g. CakePHP, Laravel, Drupal, etc…) are well supported!

phc-win "fork"

https://github.com/RDashINC/phc-win

A more-or-less forked version of phc-win, it uses the same techniques as phc-win but supports almost all modern PHP versions. (5.3, 5.4, 5.5, 5.6, etc) It also can use Enigma VB to combine the php5ts.dll with your exe, aswell as UPX compress it. Lastly, it has win32std and winbinder compilied statically into PHP.

EDIT

Another option is to use

http://www.appcelerator.com/products/titanium-cross-platform-application-development/

an online compiler that can build executables for a number of different platforms, from a number of different languages including PHP

TideSDK

http://www.tidesdk.org/

TideSDK is actually the renamed Titanium Desktop project. Titanium remained focused on mobile, and abandoned the desktop version, which was taken over by some people who have open sourced it and dubbed it TideSDK.

Generally, TideSDK uses HTML, CSS and JS to render applications, but it supports scripted languages like PHP, as a plug-in module, as well as other scripting languages like Python and Ruby.


I had problems with most of the tools in other answers as they are all very outdated.

If you need a solution that will "just work", pack a bare-bones version of php with your project in a WinRar SFX archive, set it to extract everything to a temporary directory and execute php your_script.php.

To run a basic script, the only files required are php.exe and php5.dll (or php5ts.dll depending on version).

To add extensions, pack them along with a php.ini file:

[PHP]
extension_dir = "."
extension=php_curl.dll
extension=php_xxxx.dll
...

I tried most of solution given in the 1st answer, the only one that worked for me and is non-commercial is php-desktop.

I simply put my php files in the www/ folder, changed the name of .exe and was able to run my php as an exe !!

Also there is a complete documentation, up to date support, windows and linux compatibility and options can easily be changed.


RapidEXE is exactly for this job:

It converts a php project to a standalone exe. I had enough of all other compilers, tried them one by one and they all disappointed me one way or another. Be my guest, feedbacks are always welcome!

Side note: the mechanism behind it is quite similar to the WinRAR SFX approach; extract engine, extract source, then run. It's just faster and easier to work with. One-command compilation, compressed, smart unpack, auto cleanup, easy config, full control of php engine & version; also extensible with minimal effort.

Happy developing!


http://winbinder.org/

"WinBinder is a new open source extension for PHP, the script programming language. It allows PHP programmers to easily build native Windows applications."


ExeOutput is also can Turn PHP Websites into Windows Applications and Software

Turn PHP Websites into Windows Applications and Software

Applications made with ExeOutput for PHP run PHP scripts, PHP applications, and PHP websites natively, and do not require a web server, a web browser, or PHP distribution. They are stand-alone and work on any computer with recent Windows versions.

ExeOutput for PHP is a powerful website compiler that works with all of the elements found on modern sites: PHP scripts, JavaScript, HTML, CSS, XML, PDF files, Flash, Flash videos, Silverlight videos, databases, and images. Combining these elements with PHP Runtime and PHP Extensions, ExeOutput for PHP builds an EXE file that contains your complete application.

http://www.exeoutput.com/


My experience in this matter tells me , most of these software work good with small projects .
But what about big projects? e.g: Zend Framework 2 and some things like that.
Some of them need browser to run and this is difficult to tell customer "please type http://localhost/" in your browser address bar !!

I create a simple project to do this : PHPPy

This is not complete way for create stand alone executable file for running php projects but helps you to do this.
I couldn't compile python file with PyInstaller or Py2exe to .exe file , hope you can.
You don't need uniformserver executable files.


The current PHP Nightrain (4.0.0) is written in Python and it uses the wxPython libraries. So far wxPython has been working well to get PHP Nightrain where it is today but in order to push PHP Nightrain to its next level, we are introducing a sibling of PHP Nightrain, the PHPWebkit!

It's an update to PHP Nightrain.

https://github.com/entrypass/nightrain-ep

참고URL : https://stackoverflow.com/questions/9046675/convert-a-php-script-into-a-stand-alone-windows-executable

반응형