dtl4521 2012-11-30 10:03
浏览 61
已采纳

在php中编写linux守护进程时要考虑什么,并使用hiphop进行编译以进行混淆

We want to write a Linux service in php and compile it with HIPHOP. Since we started the project with php and we could do all the programming in-house instead of hiring a c++ programmer etc. we would love to stick to php. Speed in execution is not (so) relevant for us since the daemon is just doing some monitoring but we would like to close up the code to obfuscate it. The daemon will do some network communication and logging to a db. Is this a viable route to go? In another post someone described that hiphop needs special attention in programming since not all php features are implemented. Is this still the case? I would love to here your overall opinion on our idea.

  • 写回答

1条回答 默认 最新

  • dscojuxf69080 2012-12-05 18:33
    关注

    HIPHOP is quite a beast to handle. It is very limited, so it depends specifically on your application and where it will be deployed. Remember, at present it only runs on 64 bit architectures .. so if you wanted to deploy on a 32-bit machine, you are immediately stuck in the mud.

    You may have to build many different binaries for different linux distro's depending on the nature of your application. Since HipHop only works well on Fedora and CentOS, you are severely limiting your scope. Once you move off of the PHP interpreter, you lose a very large amount of interchangeability between operating systems (Think about it: Windows, Virtually all Linux, All Major BSD Distributions, ... )

    Also keep in mind, I'm not sure to what extent you want to "obfuscate" your code. If you want to make network calls, etc and keep those hidden as well, a packet sniffer can see exactly how you are communicating with the outside world extremely easily.

    Likewise, a debugger and a reasonably seasoned programmer will be able to reverse engineer your binary to a larger degree than you may be aware.

    You may want to look into alternatives such as Zend Encoder or IonCube Encoder would be the preferred method to go about things, but these are non-free options. There are other encoders out there as well that you may want to look into.

    I'm not exactly sure what you're doing other than "monitoring", so I can't say for sure. But a secondary option would be simply to severely limit the amount of code that is being run on the client machines (assuming they are reporting to a server machine) and let the server machines, which are assumed in your total control, handle more processing if any way possible.

    I invite you to simply explore the idea yourself by testing, since once again, it's extremely dependent on the nature of your application and where you intend to deploy it. (And for many people, something like "where to deploy" can change rapidly). HipHop was created with a very narrow scope: Run PHP code as fast as possible. It isn't designed to be highly flexible or highly interchangeable between OS's and CPU Architectures. Please consider this before you write a large application reliant on it, and please make sure you fully understand every implication of using HipHop. Test, test, test.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?