Differences between ASP.NET and PHP?

Shreyans

New member
PHP and ASP.NET are two of the most widely used languages for development of web applications. Both allow development of complex and sophisticated sites, but both are very different.

PHP is a language. PHP consists of a platform-independent engine that parses PHP scripts. This language also provides common web application functionality such as database connectivity.

ASP.NET is not a language, but a technology and is a small part of the .NET Framework. The Dot NET Framework consists of a) CLR – Common Language Runtime which manages execution of the code b) a hierarchical set of class libraries. These libraries are extensive and provide a great deal of functionality both for web-based applications and well as windows-based.

ASP.NET framework is built entirely on an OOP paradigm and OOP concepts while PHP is not.

PHP does not follow the OOP paradigm entirely. It only supports partial encapsulation, and partial polymorphism.


Compilation is also different in PHP and ASP.NET.

In PHP, when a page is requested, the HTML and inline PHP script is compiled to binary format called Zend Opcodes. Once compiled, the opcodes are run by the Zend Engine and HTML is generated which is sent to the client. Commercial products are available that increase the speed at which PHP pages are executed.

In contrast, when an ASP.NET page is first requested it is converted into an intermediate language called MSIL (Microsoft Intermediate Language). The CLR then converts this MSIL to machine code. Conversion to machine code only takes place once for each page request (unless code has been modified). All subsequent requests use the already generated machine code. In ASP.NET no optimization product is required as the MSIL generated is already in its most optimized form.
 
PHP and ASP.NET are two of the most widely used languages for development of web applications. Both allow development of complex and sophisticated sites, but both are very different.

PHP is a language. PHP consists of a platform-independent engine that parses PHP scripts. This language also provides common web application functionality such as database connectivity.

ASP.NET is not a language, but a technology and is a small part of the .NET Framework. The Dot NET Framework consists of a) CLR – Common Language Runtime which manages execution of the code b) a hierarchical set of class libraries. These libraries are extensive and provide a great deal of functionality both for web-based applications and well as windows-based.

ASP.NET framework is built entirely on an OOP paradigm and OOP concepts while PHP is not.

PHP does not follow the OOP paradigm entirely. It only supports partial encapsulation, and partial polymorphism.


Compilation is also different in PHP and ASP.NET.

In PHP, when a page is requested, the HTML and inline PHP script is compiled to binary format called Zend Opcodes. Once compiled, the opcodes are run by the Zend Engine and HTML is generated which is sent to the client. Commercial products are available that increase the speed at which PHP pages are executed.

In contrast, when an ASP.NET page is first requested it is converted into an intermediate language called MSIL (Microsoft Intermediate Language). The CLR then converts this MSIL to machine code. Conversion to machine code only takes place once for each page request (unless code has been modified). All subsequent requests use the already generated machine code. In ASP.NET no optimization product is required as the MSIL generated is already in its most optimized form.
 
hi im looking to start building my first web app. i have researched in ASP.NET and PHP but still can find out which would be better to use.

i looking for what differences they have to each other, eg database connections, security implications etc.

also what are the advantages to using either and is there disadvantages for examples problems im likely to encounter.

if any one could help me out it would be hugely appriciated.
 
ASP.NET is Microsoft and PHP is Open Source. You don't need a license for PHP, you join the majority of installations out there on the web, you gain a community ready to help you. Linux is the better web development platform. Period. And the combination of LAMP is a quick install of Linux, Apache, MySQL, python-PHP-perl, with the equivalent WAMP for Win platforms.

No matter what other arguments about ASP.NET, it is still Windows and susceptible to viruses and the whims of the LICENSE that Microsoft grants you. Read the EULA on any Microsoft product and they grant you a License and not ownership. Furthermore, they reserve the right to discontinue service at any time without notice and do give the government access to your work(s). It takes forever and a day for a Windows product to warm up while it runs virus scans and file inventory before granting you full access.
 
The biggest difference is that ASP.Net is a lot faster than PHP. This is because .Net code is compiled as .Net CLR (Common-Language-Runtime) which is JIT compiled to native machine code.

PHP is interpreted at runtime, making it slower.

Also, PHP has no concept of 'code-behind' , which is where code to generate the page itself (purely from a design and looks perspective) is kept separate from the underlying logic.

Also ASP.Net controls allow for triggered events. For example you can have a piece of code that executes when a button is pressed, without having to set up a form - write a handler when the page is loaded, and display the result.

ASP.Net also has better support for parametrized queries, and strongly typed data (Infact, PHP is loosely typed) which makes it much easier to write secure backend code that connects to a database that dosen't get hit by SQL injection attacks.

I have to code in PHP full time, but would much rather use ASP.Net.
 
Back
Top