Monday, August 11, 2014

PH7 - PHP Embedded In ~600K

Somebody sent me a link to this last night and I was able to successfully compile it with Open Watcom.

Just. Wow. Was only able to run a few CGI tests with it and was blown away.

PHP 5.3 is normally 7 megabytes (minimum, normal is 15 MB) and not easy to embed and compile cross-platform at all. This is one of the reasons I ruled it out for VOS because it was just too big to fit on a floppy in one executable. PHP would be the right choice for a cgi scripting language in every regard except it's memory footprint is ridiculous under usual conditions.

I was trying to rewrite the inventory functionality in Lua Server Pages about a week ago and I was thinking that LSP is very small but hardly a rapid development scripting language for a real-time web server. At the rate I am going it would take me a couple of weeks to port existing pages in VOS and I have been too busy to work much on it at all.

PHP has an awful lot of boilerplate code floating around to do a lot of different things. Compared to Lua Server Pages it is ubiquitous. There are modules to do caching as well in the PHP global space. (Good for loading all required stuff like images and templates at run-time and then accessing it from RAM instead of loading again from the disk)

P.S. Was thinking about it and realized you could compile a custom "php-cgi.exe" that would run under DOS Desqview and use QEMM as a RAMDISK to save loading time. Most people would say a DOS port is not important but I want to keep it open as a possible cross-platform target.


Mex Arcane said...

Most people would say fitting VOS on a floppy disk is not important.

Texas Arcane said...


In the 14 years I've been working on VOS it has been my target goal. Although it is not a real priority any more (almost everyone will use USB and Flash RAM nowadays to install it) it was always a good goal to make it an all-in-one executable with zero config, zero install, zero requirements. I can do that now using this PH7 code and still have a really rich web scripting environment, with custom functions added for the VOS hardware server.