How PHP calls programs written in C #

Source: Internet
Author: User
Tags php website
The actual scenario is: already have a relatively complex program written in C # (non-WEB programs, implementation of some algorithms), now there is a PHP website, I need to embed this C # application in the PHP Web page to use. Search a lot of results, all said compiled into a DLL for PHP call, but the Web application needs to be compatible with Linux and Windows system, if you use dll,linux it seems not possible. What better way to ask the gods, to kneel and thank


Reply to discussion (solution)

External programs that can be called by PHP must not have user interaction (users may not be able to run to your server to click the mouse or press a few keys)
So it's not wrong to compile into a DLL.

As for the ability to run C # programs in Linux, it is said to be possible, but what software to install

However, C # needs to run in the. NET environment, which is much less efficient than C + +. Since you can write in C #, why not use C + +? There's no interface anyway, and C # 's advantage is gone.

External programs that can be called by PHP must not have user interaction (users may not be able to run to your server to click the mouse or press a few keys)
So it's not wrong to compile into a DLL.

As for the ability to run C # programs in Linux, it is said to be possible, but what software to install

However, C # needs to run in the. NET environment, which is much less efficient than C + +. Since you can write in C #, why not use C + +? There's no interface anyway, and C # 's advantage is gone.


Thank you for the answer on the first floor. Well, I'm just doing two development of the existing PHP system, and I'm going to need to embed the algorithm that someone else has developed (C #) into the application. The algorithm is quite complex, the rewriting is not very practical, and requires new research to replace the algorithm module.
PHP must be with C # write the algorithm between the parameters, and get back the results, I also saw that Linux to install a certain software can be used, but very unstable, a lot of defects.

As a second-hand program ape, I can only say that I will add a Web interface in C #, take the algorithm a little time to change the HTTP protocol API, return the JSON, and then use PHP's curl to call, simple rude

Then you don't have to take care of Linux, honestly working in Windows

Estimates can't be realized, C # that thing don't want to cross the platform AH.

C # provides interfaces Ah
Interacting with HTTP + json and PHP

C # is more troublesome in Linux. Let's get a different idea.
Write a Web in C # and then use HTTP to access the call.

Then you don't have to take care of Linux, honestly working in Windows


Thank you moderator, search a lot of information, finally can only this, like you said only consider Windows system it. Now can only be made compatible with other modules, this module is only for Windows, the completion of the completed on time is more important, thank you

As a second-hand program ape, I can only say that I will add a Web interface in C #, take the algorithm a little time to change the HTTP protocol API, return the JSON, and then use PHP's curl to call, simple rude


Yes, thank you, the train of thought is very detailed.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.