简体   繁体   中英

PHP code located on linux server needs to run 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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM