How does PHP call a program written in C #?

Source: Internet
Author: User
The actual scenario of how PHP calls a program written in C # is: there is already a complicated program written in C # (non-Web program that implements some algorithms ), now there is a PHP website. I need to embed this C # application into the PHP webpage. After searching a lot of results, it is said that after being compiled into a dll for PHP to call, but web applications must be compatible with Linux and Windows systems. if dll is used, it may not work in linux. Are you sure you want to do anything better? thank you ~


Reply to discussion (solution)

External programs that can be called by php must have no user interaction (users cannot go to your server and click the mouse or press a few keys)
So there is no error in compiling to a DLL.

It is said that C # programs can be run in Linux, but what software should be installed?

However, C # needs to run in the. net environment, which is much less efficient than C ++. Since you can use C # to write data, why not use C ++? There is no interface, and the advantage of C # is no longer

External programs that can be called by php must have no user interaction (users cannot go to your server and click the mouse or press a few keys)
So there is no error in compiling to a DLL.

It is said that C # programs can be run in Linux, but what software should be installed?

However, C # needs to run in the. net environment, which is much less efficient than C ++. Since you can use C # to write data, why not use C ++? There is no interface, and the advantage of C # is no longer


Thank you for your answers on the first floor. This is the case. I only conduct secondary development on the existing PHP System and require embedding the (C # written) algorithm developed by others into the application. The algorithm is complex and huge, and the rewriting is not practical. In addition, it is required that new research may replace the algorithm module.
PHP must pass parameters between the algorithm written in C # and retrieve the result. I have seen that it can be used to install a software in Linux, but it is unstable, there are many defects.

As a second-hand programmer, I can only say that I will add a web interface to C #, change the algorithm to an http api, and return json, and then use php curl to call it, which is simple and crude.

So you don't need to take care of Linux, and work honestly in windows.

It is estimated that it cannot be implemented. C # doesn't want to be cross-platform.

C # interfaces
Interaction with php using http + json

C # It is troublesome in linux. Change your mind.
Use C # to write a web, and then use http to access the call.

So you don't need to take care of Linux, and work honestly in windows.


Thanks to the moderator, I have searched a lot of information and I can only do this. as you said, I only want to consider windows. Now we can only make other modules compatible. this module is only for windows. it is important to finish the configuration on time. thank you!

As a second-hand programmer, I can only say that I will add a web interface to C #, change the algorithm to an http api, and return json, and then use php curl to call it, which is simple and crude.


Thank you. the train of thought is very detailed. thank you very much.

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.