是否可能将PHP作为脚本语言嵌入到桌面应用程序中

时间:2021-10-01 20:44:33

I know that my customers know PHP because i'm working on a PHP Tool (Running as a MFC Desktop Program)

我知道我的客户都知道PHP,因为我正在开发一个PHP工具(作为MFC桌面程序运行)

Is it possible to embedd the PHP interpreter in a general purpose way like Python, Ruby, Lua or Javascript? And if yes - is it a hack or is there a clean solution.

是否可能像Python、Ruby、Lua或Javascript那样以通用的方式嵌入PHP解释器?如果是的话,它是一个hack,还是一个干净的解决方案。

4 个解决方案

#1


0  

It appears the state of the art requires some hacking.

看来目前的技术需要一些黑客技术。

You can compile php from source, passing --enable-embed=[shared|static] to configure.

您可以从源代码编译php,传递-启用-嵌入=[共享|静态]来配置。

Evidently, that's not all that simple, but the facebook folks have evidently tried to improve it, creating phpembed

显然,这并不是那么简单,但facebook的员工显然试图改进它,创建了phpembed

This slide deck from back in 2006 seems to have some interesting tidbits on working with the library created via --enable-embed

从2006年开始的这张幻灯片似乎有一些有趣的花絮,关于如何使用通过启用嵌入创建的库

#2


1  

Can you rewrite the language using PHP-GTK? That's how I make Win32 PHP apps.

你能用PHP-GTK重写语言吗?这就是我制作Win32 PHP应用程序的方式。

If you're running .NET, then you need to check out Phlanager, and then the answer is definitely yes.

如果您正在运行。net,那么您需要检查Phlanager,然后答案肯定是肯定的。

Finally, there's various PHP compilers that can compile PHP code into DLLs that your apps can use natively. see: http://phpcompiler.org/

最后,还有各种PHP编译器可以将PHP代码编译成您的应用程序可以使用的dll。参见:http://phpcompiler.org/

#3


0  

Potentially yes, although it is likely to be a hack.

可能是的,尽管这很可能是一个黑客。

#4


0  

There's also embeddable PHP runtime PH7 if you don't mind its GPL-like-or-commercial license.

还有可嵌入的PHP运行时PH7,如果您不介意它的类似gpl或商业许可证的话。

#1


0  

It appears the state of the art requires some hacking.

看来目前的技术需要一些黑客技术。

You can compile php from source, passing --enable-embed=[shared|static] to configure.

您可以从源代码编译php,传递-启用-嵌入=[共享|静态]来配置。

Evidently, that's not all that simple, but the facebook folks have evidently tried to improve it, creating phpembed

显然,这并不是那么简单,但facebook的员工显然试图改进它,创建了phpembed

This slide deck from back in 2006 seems to have some interesting tidbits on working with the library created via --enable-embed

从2006年开始的这张幻灯片似乎有一些有趣的花絮,关于如何使用通过启用嵌入创建的库

#2


1  

Can you rewrite the language using PHP-GTK? That's how I make Win32 PHP apps.

你能用PHP-GTK重写语言吗?这就是我制作Win32 PHP应用程序的方式。

If you're running .NET, then you need to check out Phlanager, and then the answer is definitely yes.

如果您正在运行。net,那么您需要检查Phlanager,然后答案肯定是肯定的。

Finally, there's various PHP compilers that can compile PHP code into DLLs that your apps can use natively. see: http://phpcompiler.org/

最后,还有各种PHP编译器可以将PHP代码编译成您的应用程序可以使用的dll。参见:http://phpcompiler.org/

#3


0  

Potentially yes, although it is likely to be a hack.

可能是的,尽管这很可能是一个黑客。

#4


0  

There's also embeddable PHP runtime PH7 if you don't mind its GPL-like-or-commercial license.

还有可嵌入的PHP运行时PH7,如果您不介意它的类似gpl或商业许可证的话。