Comparing PHP to .Net is not really a valid comparison in some ways, because PHP is a programming language, while .Net is a development framework.
Strengths of PHP
- Open source
- Low-cost hosting
- Freedom of code direction – there are no prescribed boundaries to PHP, which a lot of developers find attractive (this is also a risk, see below).
- You can host on Linux/Windows/Unix/Apache.
- You can use MySQL, Oracle, Sybase, MS SQL Server for database.
Liabilities of PHP
- It’s an older technology, and an interpreted language – thus, it is rendered line-by-line by the web server. Easy to make coding mistakes that lead to poor performance, security risks, etc.
- No one “owns” it, so no one is jumping up to fix problems when they arise.
- Learning curve, development time – PHP allows you to do pretty much anything .Net will, but you have to code everything yourself (unlike .Net, where the framework does a lot of this for you).
- Security is risky if developer does not know what they are doing.
- Debugging is difficult. PHP tools aren’t as rich as the .Net debugger, for finding errors/issues before launching sites.
Strengths of .Net:
- Framework provides many features you would otherwise need to build, like classes for sending mail, encryption, database interaction, form security, etc. With PHP, you need to create all of this yourself or borrow someone else’s code, as there is no single approved framework/library to utilize.
- Security – the .Net framework has many security features built-in, and doesn’t allow you to make coding mistakes that threaten performance or security.
- Compiled code. .Net code is compiled before execution, whereas PHP is interpreted at runtime. This gives .Net the advantage of finding issues and letting you troubleshoot/fix them without actually running the code/page each time you want to check it.
- Debugging is easy. The .Net debugger allows you to step line-by-line through your code as it runs locally to debug issues before ever putting the code on the server.
- You can code in many different languages, even within the same project (C++, C#, VB, F#, J#).
Liabilities of .Net
- Hosting/infrastructure and dev tools can be expensive – Windows servers, Visual Studio, SQL Server are great tools/platforms, but are expensive to purchase and upgrade.
- Not as much community involvement – PHP has a rich user base, being open source, with developers sharing code. .Net has similar communities, but it all is built on the back of what Microsoft decides to do, so the communities can be a little ‘handcuffed’.
- You have to host on a Windows Server.
- Pretty much have to use SQL Server for database.