Convert PHP Class in apache module

本秂侑毒 提交于 2019-12-02 21:30:00

问题


I have write a sophisticate system in php5 (many classes that use static method and include other files)

Now I want to distribuite that ant i would choose the module way, so i like to create a module like myFramework.so and include it in Apache (maybe) and after, when i write some php app, I'll use method and/or classes.

Now i write

<?php
include("myFramework.php");
myClass::callMymethod();
?>

The problem is I won't to share my source code and i don't think that obfuscation of code is the better way, so, i prefer to create a module compiled but i don't know :

1 - if is it possible 2 - if Yes, what is the ways 3 - other way

I whant to do that

<?php
myClass::callMymethod();
?>

and no use autoinclude, i wont to protect my code, i see that if I include curl module or mysql lib, I can use function for both, how I can create that with my framework?


回答1:


No, you cannot compile a PHP class into an Apache module. You may be able to rewrite it as a PHP extension, but that will effectively involve rebuilding your code from scratch in C -- you cannot simply convert PHP to an extension.

You will probably have better luck using a PHP encoder (e.g, Ioncube or Zend Guard) for this task.




回答2:


Take a look at hiphop:

  • http://developers.facebook.com/blog/post/358/
  • https://github.com/facebook/hiphop-php/wiki/

Developed at Facebook, and project / code hosted on Github. Will convert code into C++, it depends on what you are trying to achieve, if it is protecting you intellectual property I would agree with duskwuff, Ioncube or ZG.

Worth noting is that once converted with hiphop, the result is not run as an Apache module but rather using a proprietary server also written at FB; well from what I have read so far.



来源:https://stackoverflow.com/questions/6963633/convert-php-class-in-apache-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!