Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using PHP in a .NET C# project

Does anyone out there know if it's possible (and if there's any complications with) using the PHP language inside a .NET C# project?

I understand that with VB and C# can be now mixed in solutions, so I wondered if, as IIS is now capable of running PHP, you can combine them into a singular runtime?

Obviously the reason for asking is to be able to get the same developers to work on the same parts of a single Web Service without having to learn C#/PHP - although I do know that working with the same language here is the ideal scenario.

like image 429
Chris Dixon Avatar asked Jan 10 '23 11:01

Chris Dixon


1 Answers

You can run PHP apps on IIS.

You won't be able to combine an ASP.NET and a PHP app in a same runtime, but you can host them within the same IIS server and make them communicate through (for example) a RESTful interface.

For the sake of simplicity, I would host PHP app as a separate website from ASP.NET' one. Given said that, technically, nothing forbids you to host both PHP and ASP.NET from the same website (if, for example, you have a constraint at hosting level).

Mixing several languages (such as Python and Java, or PHP and C++) within an app is currently used for large apps when people with different backgrounds and language preferences won't have to know the whole system anyway. This being said:

  • This requires a well-done architecture with a well-done interface which will never or rarely change until the end of the project. Changing the interface between PHP part and ASP.NET part of the app will be disastrous for the schedule of most projects.

  • Doing it for small projects is an overkill. You'll end up being forced to learn both languages anyway.

like image 52
Arseni Mourzenko Avatar answered Jan 20 '23 11:01

Arseni Mourzenko