4

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.

5
  • php-compiler.net ??? Commented Jun 3, 2014 at 10:25
  • Can that be used alongisde C#? Commented Jun 3, 2014 at 10:29
  • According to their documentation, it looks like it. I've never used the product so I can't endorse it, but it looks promising. Commented Jun 3, 2014 at 10:31
  • How about this: ironphp.codeplex.com Commented Jun 3, 2014 at 10:36
  • PeachPie: Using PHP in a .NET C# Project Commented Oct 14, 2019 at 13:15

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I figured that'd be the case unfortunately. Thanks!
4

Visit

http://www.codeproject.com/Articles/400713/Using-Csharp-in-App-Code-from-PHP-scripts]

I hope this is useful to you.

Thanks.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.