Fordiman Posted October 18, 2004 Share Posted October 18, 2004 I'm currently working on a way to "compile" php scripts in Win32 in the following way. Current target: php_cli.bin - modified, compiled version of php_cli.c that will look in its own windows resources (PHPScript|1|1033) for the script to execute. Default CLI settings (no execution time limit, 32M Ram use) and the php_cli.ini will also be embedded. Optionally, the php(4|5)ts.dll (UPX --best compressed, about 1M in size) can be embedded for total portability. The .bin will be compiled for stealth (Set for Win32 GUI) mode, so Win API calls can be made to produce output without having to have an ugly console window. The "compilation" process is simply insertion of the target script into a copy of the CLI. Future targets: Default script resource to PHPScript|index.php|1033 and compile in an fopen wrapper that allows for embedding and inclusion of multiple PHP scripts (ie: win32.resource://otherfile.php ). Default gzip -9 compression of internal scripts to deter (not so much prevent) end-user tampering. Anyway, any tips anyone can pass my way would be great, especially in using gcc/gpp as my compiler for php under Win32 (I just don't have the cashish for VS). Quote Link to comment https://forums.phpfreaks.com/topic/2000-poor-mans-php-compiler/ Share on other sites More sharing options...
Fordiman Posted November 11, 2004 Author Share Posted November 11, 2004 UPDATE: I've written the PHP extension to allow for opening resources as files in PHP (called resopen, resread, etc. For not-yourself files, you can even write resources via a simulated stream interface, but that's a memory hog for large files. I may work on self-rewriteing, but I wouldn't count on it.) Additionally, using a bit of code from Back Oriface 2000, I've managed to get PHP to load its DLLs from it's own resources (Resource type: DLLDATA). The next step is to have php bootstrap from win32.res://self/phpscript/1/1033, and to write an fopen wrapper (into php_peres.dll) so that resource files can be accessed with the existing file-handling functions. Quote Link to comment https://forums.phpfreaks.com/topic/2000-poor-mans-php-compiler/#findComment-6682 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.