Awesome project - can it be made smaller tho?

2,946 views
Skip to first unread message

Matt Pass

unread,
Mar 26, 2014, 3:35:40 AM3/26/14
to phpde...@googlegroups.com
Hi Czarek

Truly awesome work here - it's great you can turn your PHP based site into an app in under 5 mins. So straightforward and love that you can modify your site (and therefore 'app') still, it's like open software!

I've already taken ICEcoder (http://icecoder.net), my browser based code editor, and got it working like desktop software. Only a few minor issues so far, which I can hopefully look to resolve - but I may ask the odd question as I test everything out.

Something I was wondering tho - can it be made any smaller? Considering it contains a web browser, web server and PHP, 116mb including Chromium is quite good, but wonder if I can remove some parts? ICEcoder is around 350k and Mongoose is also tiny (about 600k I think), so I'm assuming it's PHP, Chromium or PHP Desktop itself that has the larger files.

Perhaps knowing what the larger (> 1mb) files are/do, I may be able to remove a few of them that aren't needed for me? Any tips/pointers on what they are here would be great.

(By the way, none of this is a complaint at all, just wondering if it's possible. Am just used to having pretty small web apps (ie, under 1mb), always like every byte to justify itself being there and wonder if I can trim it down).

Am thinking of providing an 'ICEcoder Desktop' version if I can get the install a bit smaller.

Many thanks,
Matt

Czarek Tomczak

unread,
Mar 26, 2014, 10:32:04 AM3/26/14
to
Hi Matt,

There is a "minified" version of phpdesktop available, it has smaller PHP binaries. See:

100 MB - phpdesktop-chrome-31.6-php-5.4.24
71 MB - phpdesktop-chrome-31.6-php-5.4.24-minified
104 MB - phpdesktop-chrome-31.6-php-5.5.8
71 MB - phpdesktop-chrome-31.6-php-5.5.8-minified

In the PHP minified version many extensions were removed, also the "icu" dlls were removed that add unicode support to PHP. This makes the PHP binaries smaller by 33 MB by minifiying only PHP 5.5.8.

The phpdesktop binaries itself are only 0.5 MB (the phpdesktop-chrome.exe file).

Most of the size is taken by the Chromium/CEF binaries. These are the *.dll and *.pak files in the root directory (cef.pak, d3dcompiler_43.dll, etc.). See the CEF README.txt file to know which of these files are required and which are optional, it also explains which files provide what features:


You can remove the following files if you do not need Html5 Audio/Video support, webgl, CSS 3d, nor developer tools:

cef.pak
d3dcompiler_43.dll
d3dcompiler_46.dll
devtools_resources.pak
ffmpegsumo.dll
libEGL.dll
libGLESv2.dll

This will save you 13 MB and will make phpdesktop in total only 59 MB. After compressing using 7z algorithm with Ultra/Lzma compression this will give you a 19 MB compressed file for distribution (both Inno Setup and NSIS installer support 7z compression).

There are still 10 extensions in the PHP minified binaries, they take about 3 MB in size, you can remove them as well if you don't need them. If you don't need SSL/HTTPS then you you can remove libeay32.dll and ssleay32.dll files and save save some more space. After these changes it will be 55 MB uncompressed and 17 MB compressed

If uncompressed size matters to you then you could use a tool named UPX (http://en.wikipedia.org/wiki/UPX , http://upx.sourceforge.net/). It can reduce size of dll files by about 60%. After running upx on libcef.dll, icudt.dll and php5.dll I have reduced the size from 55 MB uncompressed to 22 MB uncompressed (uncompressed in the sense that all files reside freely on hard drive and not inside an archive file).

There is also phpdesktop MSIE version with Internet Explorer engine that gives you smaller binaries (about 5 MB after compression), but has its caveats, it depends on IE version installed on user's computer.

Best regards,
Czarek

Matt Pass

unread,
Mar 26, 2014, 9:17:13 AM3/26/14
to phpde...@googlegroups.com
Superb reply - thanks very much for taking the time to provide all this info.

I'll be sticking with the Chromium version as there's less unknowns than you get with IE. Certainly need to keep dev tools, but a lot of stuff can be dropped for me I think.

Tough call on if I should provide Unicode - guess I should really, or perhaps offer users the an install in 2 different flavours.

May spend a day or deciding what to keep, creating a trimmed version and see how small I can get things.

This all goes a long way to helping decision making, thanks again!

Matt


Czarek Tomczak

unread,
Mar 26, 2014, 10:34:09 AM3/26/14
to
It turns out I had a "webcache" directory within phpdesktop binaries and it was about 11 MB. I have updated the numbers in my previous post. The final uncompressed size is 55 MB and 17 MB after compression.

I have also added additional info to the previous post about using UPX to reduce the size of uncompressed binaries:

If uncompressed size matters to you then you could use a tool named UPX (http://en.wikipedia.org/wiki/UPX , http://upx.sourceforge.net/). It can reduce size of dll files by about 60%. After running upx on libcef.dll, icudt.dll and php5.dll I have reduced the size from 55 MB uncompressed to 22 MB uncompressed (uncompressed in the sense that all files reside freely on hard drive and not inside an archive file).

So the final result is reducing binaries size from 104 MB to 22 MB - that's quite a lot. 

-Czarek

Matt Pass

unread,
Mar 26, 2014, 10:55:36 AM3/26/14
to phpde...@googlegroups.com
That's even better! For me, would have been OK with a 55MB app, but 22MB after using UPX sounds ace.

I'm guessing after packing into an install prog (using Inno Setup), the setup.exe will be ~10MB, which is ideal. Really quite impressed that we can have a web server, Chromium, dev tools and a open source/open app code editor all within 22MB!

(Also really good news that we can get it so small while being uncompressed. Users often want to customise ICEcoder and this means it's still open source for them).

OK, guess it's down to me to check everything in ICEcoder works within PHP Desktop now then. Think most things work, but some don't so will ask questions if I get stuck anywhere.

Thanks again,
Matt

Czarek Tomczak

unread,
Mar 26, 2014, 11:15:38 AM3/26/14
to
UPX compresses files so these can't be compressed further. It also has a minor downside, it compresses each file separately, thus the 7z archive file for all these files will be a bit bigger. Some numbers:

55 MB uncompressed / 7z = 17 MB compressed.
55 MB uncompressed / upx = 22 MB uncompressed / 7z = 19 MB compressed.

UPX also adds some delay for application startup, as it needs to uncompress the dll files on the fly. There is some minor glitch I've noticed after upxing Chromium dll files - the window gets black for a second during startup, probably due to increased startup time.

-Czarek

arunbar...@gmail.com

unread,
Apr 17, 2014, 6:07:58 AM4/17/14
to phpde...@googlegroups.com
Hi,

I need to share that exe with other windows system.

I shared with other pc but it display some error while to connecting with mysql database.

In local host it is working good with wamp server.

And this the error it show in network computer

Warning: mysqli_connect(): (HY000/2002): No connection could be made because the target machine actively refused it. in \\192.168.1.123\DOWNLOAD2014\phpdesktop-msie-1.13-php-5.4.24\phpdesktop-msie-1.13-php-5.4.24\www\include\dbconnection.my.mysqli.php on line 9

Fatal error: No connection could be made because the target machine actively refused it. in \\192.168.1.123\DOWNLOAD2014\phpdesktop-msie-1.13-php-5.4.24\phpdesktop-msie-1.13-php-5.4.24\www\include\dbconnection.my.mysqli.php on line 12

I have configured the apache and mysql for lan seeting.

Please help me to solve the problem.

Czarek Tomczak

unread,
Apr 17, 2014, 6:26:16 AM4/17/14
to phpde...@googlegroups.com
arunbarath12345, You should not post your problems in topics created by others. Create your own topic. Your errors/problems seem not to be related directly to phpdesktop, seems like general php problem and for such I recommend looking for help on some other PHP forums.

-Czarek

Hendra Gunawan

unread,
Jan 26, 2018, 4:17:15 AM1/26/18
to PHP Desktop
Hello.

I have tried to eliminate files one by one. for "PHP Desktop Chrome 57.0", here's my conclusion about the required files:
  • chrome_elf.dll
  • libcef.dll
  • natives_blob.bin
  • icudtl.dat
  • cef.pak
Reply all
Reply to author
Forward
0 new messages