SitePoint Sponsor |
|
User Tag List
Results 1 to 25 of 95
Thread: PHP vs. ASP.NET Fight
-
Jul 10, 2002, 07:10 #1
- Join Date
- Mar 2002
- Location
- Miami, Florida - Caracas, Venezuela
- Posts
- 379
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PHP vs. ASP.NET Fight
I need help!
I'm a designer in the process of learning PHP and need some help. At work developers from the IT Dept. keep arguing that asp".NET" is better (for many reasons that they have failed to explain) than PHP. They say PHP can't survive and that it doesn't compare to the speed and agility of ASP.NET.
One of the explanations that I did get is that with asp.net you can comile code into much faster *.aspx files. Is there an equivalent in PHP?
In your opinion what are the pros and cons of each?
Help me win this one please!!!
Thanks,
LGLuis
-
Jul 10, 2002, 07:58 #2
-
Jul 10, 2002, 09:35 #3
- Join Date
- Jan 2001
- Location
- Lawrence, Kansas
- Posts
- 2,066
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Any speed differences will only become noticeable if your site gets hundreds of hits a minute. ASP.NET does have some significant advantages (the standard class library and the fact that C# is a very nice language spring to mind), but at the end of the day its biggest disadvantage is that if you go with ASP.NET you are pretty much tying yourself to developing for the Windows platform, which leaves you stuck in Microsoft's insidious (and expensive) upgrade cycle
PHP can be deployed on a much wider range of operating systems and doesn't tie you to one vendor.
(I know Mono is an open source project that plans to get .NET running on non-MS platforms, but I don't trust MS not to deliberately screw it up somehow so I will only believe it when I see it deployed).
-
Jul 10, 2002, 11:08 #4
The notion that PHP 'cannot survive' in the face of ASP.NET is, and always has been, total bullfaeces. PHP is free, open source software which can run on damn near any web platform and integrate almost every web technology you care to name. ASP (and ASP.NET) is prorietary, and stuck on Windows. Ive no doubt whatsoever that your IT dept people are long time Microsoftphiles who have probably never used PHP anyway.
PHP is also a far more appropriate choice for most web apps, in the same way that Java is not always a good choice.THE INSTRUCTIONS BELOW ARE OLD AND MAY BE INACCURATE.
THIS INSTALL METHOD IS NOT RECOMMENDED, IT MAY RUN
OVER YOUR DOG. <-- MediaWiki installation guide
-
Jul 10, 2002, 13:53 #5
- Join Date
- Nov 2000
- Location
- Switzerland
- Posts
- 2,479
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
One of the explanations that I did get is that with asp.net you can compile code into much faster *.aspx files. Is there an equivalent in PHP?
They say PHP can't survive
As to agility, ask them if they can write a Lotus Notes client in ASP. Then point out that you could write in Java and PHP for about 2 years now and it's now possible to drop Python into PHP.
The only thing .NET really has to offer that PHP can't do easily (if you discount PHP-GTK) is to interface natively with the client (Windows). Which is nice but given MS's security record, if they unleash that on an unsuspecting Internet, all hell will break lose.
Main thing to remember is you can't compare PHP with ASP.NET. PHP and ASP can be compare (they're both languages) but .NET is an application framework. Anyway - enough already - it's well discussed in other threads.Last edited by HarryF; Jul 10, 2002 at 13:56.
-
Jul 10, 2002, 14:40 #6
- Join Date
- Jun 2002
- Location
- .chicago.il.us
- Posts
- 957
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Re: PHP vs. ASP.NET Fight
At work developers from the IT Dept. keep arguing that asp.NET is better (for many reasons that they have failed to explain) than PHP.
They say PHP can't survive and that it doesn't compare to the speed and agility of ASP.NET.
In your opinion what are the pros and cons of each?
PHP has a stronger (more C-like) syntax, while ASP is highly verbose and looks more like pseudocode than like programming.
All the .net languages are new and untested, and knowing Microsoft's reputation, there will no doubt be hundreds of security holes and bugs discovered in the CLR. PHP has been in wide-spread use for a few years now, and is completely open-source, so bugs are few and they are fixed immediately.
A PHP program can send an email with ONE LINE of code. Try that in ASP.net
Want more?
-
Jul 12, 2002, 14:51 #7
- Join Date
- May 2002
- Posts
- 3
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Re: Re: PHP vs. ASP.NET Fight
Originally posted by randem
A PHP program can send an email with ONE LINE of code. Try that in ASP.net
Code:System.Web.Mail.SmtpMail.Send("from@email.com", "to@email.com", "Subject", "Body");
-
Jul 12, 2002, 15:02 #8
- Join Date
- Feb 2001
- Posts
- 302
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Re: Re: PHP vs. ASP.NET Fight
Originally posted by randem
PHP has a reputation for beating ASP in the speed tests.
PHP has a stronger (more C-like) syntax, while ASP is highly verbose and looks more like pseudocode than like programming.
PHP only has a more C-like syntax than VB, not C# or J#. Anyway syntax is secondary anyone can quickly learn the syntax of a different language, it is the concepts that take longer, of which all the .net languages have more in common with C++ than PHP.
-
Jul 12, 2002, 18:21 #9
- Join Date
- Sep 2001
- Location
- Vancouver
- Posts
- 370
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
In my opinion php has some huge advantages.
- You can run it on so many operating system
- if something is broken it will be fixed a lot quicker then asp.net because of it's huge openness
- Easy to Learn many resources
- Hotscripts.com - look at whats already done for free, with this said you can saves hours in programming time by borrowing others code for the beginning of your projects.
- The php community is also much more open, there are so many resources to help others along.
These advantages don't have much to do with the actual syntax comparison but in my opinion they are very valid.
-
Jul 12, 2002, 18:25 #10
- Join Date
- Sep 2001
- Location
- Vancouver
- Posts
- 370
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Re: Re: PHP vs. ASP.NET Fight
Originally posted by randem
Eventually, after you push them long enough, they all revert back to the same argument: Microsoft has $40bn in cash, they'll always win. (guess again...)
.
-
Jul 13, 2002, 08:23 #11
- Join Date
- Sep 2000
- Location
- Halmstad, Sweden
- Posts
- 7,400
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Re: Re: Re: PHP vs. ASP.NET Fight
Originally posted by Atomsk
A PHP program can send an email with ONE LINE of code. Try that in ASP.net
ok
Code:System.Web.Mail.SmtpMail.Send("from@email.com", "to@email.com", "Subject", "Body");
This reflects many PHP guys opinions on ASP. So many people automatically put off Microsoft technologies before even trying them.
I started with PHP about 18 months ago, and have done it since. I love the language, and I definitely don't think it will die. However, I'm currently looking into ASP.NET, and I can safely say that it, without real contest, is generally superior to PHP. The "battle" between old-ASP and PHP generally just came down to a matter of taste and amounts of jobs, but ASP.NET really is superior, believe me.
ASP.NET has several major differences from PHP:
- It's compiled
Just like all .NET software, ASP.NET is compiled. This makes it immensely faster than PHP, which is interpreted. Not really an issue unless you have enormous amounts of page views (think 150 per SECOND), though. - It's written using full OOP programming languages
ASP.NET is written using "real" OO programming languages of your choice. PHP is just a simple scripting language in comparison to C# or C++. This gives you more control, speed, and more reusability, but also means that code is more complex, and has a steeper learning curve. - It separates code and HTML really nicely
This is where ASP.NET, IMHO, really does blow PHP out of the water. Out of the box, PHP's separation of content and code is a piece of donkey excrement. Once you start using a proper templating system like Smarty, things look much better. However, ASP.NET's Web Forms, Server/User Controls and Data Grid just smacks Smarty around with a trout, really. It's so smart, clean and saves so much time. Before anyone forms an opinion on ASP.NET, he/she should go read though the official ASP.NET Quick start Tutorials. Really - there is a great chance you will be impressed. - It automates a lot of the boring code
Web Forms in ASP.NET just makes you write less code. Check out Kevin Yanks article on ASP.NET form processing basics.
I'm not going to get into the debate of whether .NET is really going to be tied to the Windows platform or not (even though Microsoft HAS released the source code of the FreeBSD .NET CLI for anyone to look, and is having Corel Develop a proper framework for it), but I will say, as a PHP coder, that ASP.NET is a very good piece of technology.Last edited by M. Johansson; Jul 13, 2002 at 08:25.
Mattias Johansson
Short, Swedish, Web Developer
Buttons and Dog Tags with your custom design:
FatStatement.com
-
Jul 13, 2002, 09:49 #12
- Join Date
- Jan 2001
- Location
- Lawrence, Kansas
- Posts
- 2,066
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Don't confuse ASP and ASP.NET. ASP is basically an IIS extension to allow it to execute scripts. ASP.NET is the web scripting element of .NET, which is a whole new development platform.
PHP beats the pants off traditional ASP, but ASP.NET has some big advantages over PHP (compiled scripts, the ability to use proper OOP langauges such as C#, a very well designed standard library). That said I'm not goign to touch .NET until I'm sure that the open source implementation will be a viable alternative to hosting on a Microsoft platform.
PHP is also easier and cheaper to host.
-
Jul 13, 2002, 15:46 #13
- Join Date
- Sep 2000
- Location
- Halmstad, Sweden
- Posts
- 7,400
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Originally posted by Skunk
PHP is also easier and cheaper to host.Mattias Johansson
Short, Swedish, Web Developer
Buttons and Dog Tags with your custom design:
FatStatement.com
-
Jul 15, 2002, 06:03 #14
- Join Date
- Nov 2000
- Location
- Switzerland
- Posts
- 2,479
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I get tired of hearing this;
It's compiled
Just like all .NET software, ASP.NET is compiled. This makes it immensely faster than PHP, which is interpreted. Not really an issue unless you have enormous amounts of page views (think 150 per SECOND), though.
This thread is on the newest version of ASP, ASP.NET which is clearly faster than PHP.
PHP.ZendAccelerator is still faster than ASP.NET
It's been possible to do this for two years already, using the Zend Accelerator. What Microsoft call "compiling" in regard to .NET is not real compiling. Zend, who are more honest, admit it's a form of caching. But in case you're in any doubt, read this.
Is the Zend Accelerator a type of a Web Cache or a Proxy?
No. The Zend Accelerator is a caching module designed specifically for PHP and the Zend Engine. It does not cache HTML documents or images, but rather, compiled PHP applications. For truly dynamic pages, such performance products can actually slow down response time. The Zend Accelerator was designed to optimize the scripts that dynamic pages depend on.
Now further quotes.
From Zend here;
Deliver faster responses to user requests (up to 5 times faster!)
Most applications migrated from classic ASP see a 3x to 5x increase in pages served.
So in conclusion: Oh dear! ASP is back where it started - still lagging behind PHP (it always was faster)!
If you're going to talking about ASP.NET (which is language + application framework) then hey - I'll talk about PHP.ZendAcc in future.
Otherwise;
It's written using full OOP programming languages
It separates code and HTML really nicely
It automates a lot of the boring code
.NET blows out on being Windows only and here's a prime example. If you head to Brinkster and buy they're Premium hosting account [$13 setup + $13 / month) only then do you get access to all these Com Components. And don't expect installing new Components to be free - they cost money after all. That's a typical, cheap ASP host.
With PHP, you'll find thousands of hosting companies offering all the functionality of those components for free (as a default install) and will probably be willing to install further libraries for free or at a very small charge. That's because all the libraries are typically open source in the first place.
.NET is, in my opinion, a language only for those backed by a corporate account.Last edited by HarryF; Jul 15, 2002 at 06:45.
-
Jul 15, 2002, 07:10 #15
- Join Date
- Sep 2000
- Location
- Halmstad, Sweden
- Posts
- 7,400
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Originally posted by HarryF
PHP.ZendAccelerator is still faster than ASP.NET
That sure is going to help all those web designers out there who get by in PHP but aren't programmers and have no interesting in OO. For most web sites, you do not need OO coding. Punkt. Period. Full stop. The web is about "throw away code". And if you want OO, PHP offers it. And as it turns out, .NET isn't quite so hot at OO - think many PHP coders will grin when they see this
I've looked at links you've pointed out. I (or any reasonably experienced PHP coder) could write a PHP class that simulates the datagrid perfectly, as well as the new ASP+ / C# templating system, without a great deal of effort. And again the difference is, while MS are forcing you into a style of development, you can choose one of many PHP solutions or write your own.
I automate my own boring code, just as Kevin does here.
.NET blows out on being Windows only and here's a prime example. If you head to Brinkster and buy they're Premium hosting account [$13 setup + $13 / month) only then do you get access to all these Com Components. And don't expect installing new Components to be free - they cost money after all. That's a typical, cheap ASP host.
With PHP, you'll find thousands of hosting companies offering all the functionality of those components for free (as a default install) and will probably be willing to install further libraries for free or at a very small charge. That's because all the libraries are typically open source in the first place.
.NET is, in my opinion, a language only for those backed by a corporate account.Mattias Johansson
Short, Swedish, Web Developer
Buttons and Dog Tags with your custom design:
FatStatement.com
-
Jul 15, 2002, 07:35 #16
- Join Date
- Sep 2000
- Location
- Halmstad, Sweden
- Posts
- 7,400
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Oh, and out of curiosity, how is ASP.NET not compiled? As I've understood it, the code is compiled into native code when it is first ran, and then it's... well, compiled?
From Arstechnicas article on .NET:
When running the executable, the CLR uses Just-In-Time compilation. As each method within the executable gets called, it gets compiled to native code; subsequent calls to the same method don't have to undergo the same compilation, so the overhead is only incurred once.Last edited by M. Johansson; Jul 15, 2002 at 07:39.
Mattias Johansson
Short, Swedish, Web Developer
Buttons and Dog Tags with your custom design:
FatStatement.com
-
Jul 15, 2002, 08:38 #17
- Join Date
- Nov 2000
- Location
- Switzerland
- Posts
- 2,479
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
*Wipes froth from corners of mouth*
Oh, and out of curiosity, how is ASP.NET not compiled?
If you did deep, you'll also find little snippets like this;
ASP.NET uses a disk-based cache to store the compiled DLLs, guaranteeing a virtual infinite number of ASP.NET Web pages to be "cached" (that is, not needing to be recompiled each time the page is visited).
ASP.NET Pages are compiled
When an ASP.NET page is first requested, it is compiled and cached on the server. This means that an ASP.NET page performs very rapidly. All ASP.NET code is compiled rather than interpreted, which permits early binding, strong typing, and just-in-time (JIT) compiling to native code.
The basic idea is in old days of ASP 3.0 or PHP (without Accelerator), a script was "re-parsed" (or compiled) each time it was run. So for PHP, the langauge get's interpreted (aka compiled) into something more like C++ (bytecode I believe it's called). This wasn't particular fast so people looked for ways to speed it up.
One simple approach was to cache the output - the end result - a web page. That works for a static page but where dynamic content from a dB is concerned, you need a new version of the page each time, making this approach more or less useless.
But then someone realised that to the number of times a script gets run from a site, it very rarely changes.
So if you cache the compiled bytecode, you would save the PHP (or now ASP) parser from having to repeat the job over and over again for every script execution, while still allowing for "dynamic content", because the bytecode contains instructions on which database to access, the queries to run etc, in a form that is very fast for the low level C++ executables that make PHP "happen" to work with.
So what Microsoft and Zend are doing is partially compiling a script into bytecode then caching it for re-use. This is not the same as a executable you compile from C++ program, for example, which I'd call "truly" compiled. This quote from MS here sums it up;
Because ASP.NET does not have compile-time knowledge of any applications you write on top of it, it cannot use static references to resolve and reference application code. Instead, ASP.NET must use a dynamic class/assembly resolution approach to make the transition from the ASP.NET runtime into application code.
It's no coincidence that both are quote "5 times faster" - there's only so much this approach can do for you and both have probably hit their limits.
-
Jul 15, 2002, 17:09 #18
- Join Date
- Jan 2002
- Location
- Strongsville OH
- Posts
- 1,534
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i have been doing some research and i have found that the code validation controls that are generated by asp.net do not work with any version of netscape. another reason to go with php.
-
Jul 15, 2002, 17:54 #19
- Join Date
- Dec 2001
- Location
- Sioux City, Iowa
- Posts
- 691
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Whats that? A Microsoft product doesn't work with Netscape? Well, what did you expect from a company that has trid everything to make their web browser the only one used? Its probably just another way for Microsoft to push Netscape (and Mozilla) out of the market.
-
Jul 15, 2002, 23:52 #20
- Join Date
- Sep 2000
- Location
- Halmstad, Sweden
- Posts
- 7,400
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Originally posted by archigamer
i have been doing some research and i have found that the code validation controls that are generated by asp.net do not work with any version of netscape. another reason to go with php.
The server controls works absolutely flawlessly in any standards compliant browser (Read: IE, Opera, Mozilla, etc). I personally couldn't care less if the server controls doesn't work in NS4, since NS4 usage will be very low when .NET picks off, and secondly because NS4 users aren't even going to notice that they don't have dynamic "*".
If you are still unhappy with the form validation control javascript not working with NS4, you can just redefine/rewrite the server control. PHP doesn't even have form validation controls in the first place.Mattias Johansson
Short, Swedish, Web Developer
Buttons and Dog Tags with your custom design:
FatStatement.com
-
Jul 15, 2002, 23:57 #21
- Join Date
- Sep 2000
- Location
- Halmstad, Sweden
- Posts
- 7,400
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
You can see an example of the Form Validation here:
http://samples.gotdotnet.com/quickst...alidator8.aspx
Fill in the form, press validate, and then change the field to be incorrect if it was correct, and vice versa, and the red text beside the form field will change. Source code here.Mattias Johansson
Short, Swedish, Web Developer
Buttons and Dog Tags with your custom design:
FatStatement.com
-
Jul 16, 2002, 00:23 #22
- Join Date
- Sep 2000
- Location
- Halmstad, Sweden
- Posts
- 7,400
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Well, Harry, I guess time will tell whether ASP.NET or PHP is faster. I don't belive marketing texts, whether they come from Microsoft, Zend or anyone. I believe benchmarks. Some real benchmarks will come soon enough, I guess. One thing is sure, though - .NET is very fast. This guy made a goddarn 3D engine using it.
Mattias Johansson
Short, Swedish, Web Developer
Buttons and Dog Tags with your custom design:
FatStatement.com
-
Jul 16, 2002, 00:38 #23
- Join Date
- Sep 2000
- Location
- Halmstad, Sweden
- Posts
- 7,400
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Oh, and I just recalled an advantage of ASP.NET - it has a totally free and very good development tool for ASP.NET, called Web Matrix. It's essentially a scaled-down/customized version of Visual Studio.NET. It has WYSIWYG, Direct editing and viewing of your SQL db in the little DB window, code completion, and editing over FTP. It also includes lightweight versions of IIS and SQL server. (Full functional, but won't handle real load) There is nothing like it for PHP that is free.
ASP.NET is more expensive to host, but it's cheaper to develop for.Mattias Johansson
Short, Swedish, Web Developer
Buttons and Dog Tags with your custom design:
FatStatement.com
-
Jul 16, 2002, 00:59 #24
- Join Date
- Nov 2000
- Location
- Switzerland
- Posts
- 2,479
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well, Harry, I guess time will tell whether ASP.NET or PHP is faster. I don't belive marketing texts, whether they come from Microsoft, Zend or anyone. I believe benchmarks. Some real benchmarks will come soon enough, I guess. One thing is sure, though - .NET is very fast. This guy made a goddarn 3D engine using it.
As to marketing texts, don't believe the hype (which is exactly what everyone has done with .NET). .NET or Zend Accelerator simply optimise the process of interpreting scripts. If you know a hard core C++ coder, have a long chat with them about how a C binary is compile and how this compares to what .NET does. All in all, the .NET languages and PHP can only get so fast (and will always be as fast as each other) - there's a limit to how much you can do with a script. If you want to get faster, you'll need a true binary.
For some benchmarks, try this for a start.
-
Jul 16, 2002, 05:05 #25
- Join Date
- Nov 2000
- Location
- Switzerland
- Posts
- 2,479
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PS: Some real feedback on VS from MS developers: http://www.dnjonline.com/articles/to...newsgroups.asp
Bookmarks