Recent project needs to make such a project requirement. Writing PHP has never been involved before. Please give me some advice:
Is it possible to package php into an installation package for one-click installation (windows environment)
Code encryption recommendation
How to authorize?
To put it bluntly, I actually want to make a commercial software for an organization, but I don’t want it to be copied to other branches for use.
1. About PHP packaging
It’s no problem to package the PHP interpreter and PHP project into an installation package. I even packaged the PHP interpreter and ran it on an Android phone without any problem. Because PHP officially provides a Windows version of the binary package, I can even compile it myself This step is saved. In order to streamline the PHP interpreter, you can delete all the extensions you don’t need, such as the intl extension and its dependent ICU. After the reduction, the packaged interpreter is estimated to be less than 5 MB. Because PHP has built-in HTTP server and SQLite database, so the client no longer relies on Apache and MySQL, and can run PHP projects directly, and it also saves resources.
2. About PHP code protection
PHP7’s opcache supports using
opcache.file_cache
to export binary opcodes corresponding to PHP scripts. These opcodes are related to the operating system and PHP interpreter version and can play a certain role in code protection. In addition, Zend Guard and ionCube also provide paid PHP code encryption service.3.Authorization
For example, it can be judged in the encrypted PHP code
$_SERVER['SERVER_NAME']
. If it is not the domain name bound during authorization, the service will be directly refused.There seems to be no good code-level encryption, zend guard can encrypt the code. .
The other is to use extensions, which means you must have your extension to run. The management system of wdlinux adopts this method
For encryption, you can try this: EnPHP encryption obfuscation
About packaging, directly compress the php exe and script into a directory and call it as a bat script
As for usage restrictions, you can generally judge based on HTTP_HOST ENV
You can encrypt the php source code as shown in the screenshot. If necessary, please +2795934612