douchendan0040 2012-10-16 20:13
浏览 26
已采纳

使用mcrypt与phalanger

How to use a php extension like mcrypt? My first thought was to find mcrypt.php and simply include it (context.Include("mcrypt.php", false);), but of course that doesn't exist since it is written in C.
I was reading over Writing compiled PHP extensions in PHP post from the blog but that seems to be about creating your own extension for use in .net. But maybe Im wrong considering this statement: "Implement Phalanger extension in PHP langage. When you take your PHP library and compile it using Phalanger, the result is DLL working as any other extension" But even still phpc (phalanger php compiler) is not going to compile c code as far as I know though I haven't tried.

these are the calls my php class is trying to make: mcrypt_module_open mcrypt_enc_get_key_size mcrypt_enc_get_block_size

  • 写回答

3条回答 默认 最新

  • douche3244 2012-10-18 17:47
    关注

    Jakub Míšek's answer is definitely right and if this post helps you please vote him up as well. However I wanted to simplify what he said as his advice still took me some time to understand what he was saying. Also please Jakub if you get a chance to read this correct me if Im wrong about anything.

    First thing that got me about his answer was this file

    php_mcrypt.mng

    mng what is that???? But after digging through their [Phalanger] svn and the files located in

    C:\Program Files\Phalanger 3.0\Wrappers

    I found the mcrypt file. Also with some help from the php chat room I got a clue as to what the mng was, Managed Code.

    So after adding the file as a reference as well as editing the web.config file to include it (as Jakub shows)

      <phpNet>
        <classLibrary>
          <add assembly="php_mcrypt.mng, Version=3.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="mcrypt" />
        </classLibrary>
        <scriptLibrary/>
      </phpNet>
    

    These lines must be feeding into Phalanger to load this extension when compiling (I think/know).

    After that everything seems to compile and run fine! Thanks Jakub

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥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,如何解決?
  • ¥15 c++头文件不能识别CDialog