doudou20145 2017-06-07 15:55
浏览 81
已采纳

位于linux服务器上的PHP代码需要运行windows .exe

The project I am apart of uses a Linux server to host our code. The API I was provided to use was only usable within C#, so currently I have a Windows executable that performs a small task. This executable is called to execute by a PHP file from a website.

Currently, I am attempting to run the file remotely from the Linux server by letting the Windows executable reside on a server running Windows and doing a remote execute call using http://php.net/manual/en/features.remote-files.php, but even if this works, it doesn't seem like a safe or correct way to do things.

A senior suggested I use an IIS server to call it securely, but I am not familiar with this. Before continuing, I thought it would be responsible to ask: is there is a way to have this PHP code residing on a Linux server to run a Windows executable without having to call a remote Windows server for it to run on.

  • 写回答

1条回答 默认 最新

  • douxi3085 2017-06-07 16:01
    关注

    You could write a small web API to run on your Windows server, that after authenticating the request will allow you to execute certain commands locally. Your application running on the linux server could then send requests to this web API and either wait for the results to be returned in that request, or have the Windows server send the results back in an API request later.

    The other option which is arguably simpler... just host the entirety of your application on the Windows server.

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

报告相同问题?