7

Is it possible to encrypt/password-protect a Phar archive to enable closed-source software distribution?

MidnightLightning
  • 6,715
  • 5
  • 44
  • 68
  • What do you want to prevent? Users looking at the source code or users running the application? – cweiske Oct 18 '11 at 08:32
  • @cweiske Wanting to have a company purchase closed-source software, get the software (PHAR archive?), and run on their own server, without being able to modify the source, only interact with it (run the code). – MidnightLightning Oct 27 '11 at 16:58

2 Answers2

5

Phar supports zip, and zip files can be password-protected. But you would need a monkey for typing in the zip password whenever a request comes in. So no, not useful for closed-source software.

But to make this a somewhat serious answer, no it really doesn't work:

PHP Warning: include(phar://phar.zip): failed to open stream: phar error: Cannot process encrypted zip files in zip-based phar "phar.zip" in php shell code on line 1

mario
  • 144,265
  • 20
  • 237
  • 291
3

Wanting to have a company purchase closed-source software,

In that case, phar alone will not help you. Look for a bytecode compiler like ioncube.

cweiske
  • 30,033
  • 14
  • 133
  • 194