PHP or ASP.NET - and why

Dear All,

I am writing to ask about these two web programming language, altough I know that ASP.NET is not a programming language but a framework. However, my question is general about the two. So if there is a new comer to web programming and wants you to shorten their way, what would your recommendation should be? and most importantly, why? :slight_smile:


Web Dreamer

Hosting at my ISP is done on windows servers. Of course, they also provide php/mysql on their hosting plans so NET and PHP are both available. On a dedicated server the OS costs are substantially higher for windows OS (CentOS is their other option, at $0).

Also, if you want to run your own development server at your location, you’ll have to purchase your own windows license, which with DB software, etc, can get pricey. With some versions of Windows 7 IIS is included so you can run a basic web development system on your workstation, but I prefer to use an actual server in-house for development, and you’d need another windows license to do that.

So it’s hard for you to grasp that you actually have to pay for Windows copy or you’re deliberately playing possum?
Whether it’s 100 euros or whatever, it still is PAID for.
I find it silly to go into a debate what’s cheaper and what isn’t since there isn’t any argument. I dislike windows for many reasons (as a server), one of them being price.
I run Linux based servers, I find them way easier to maintain, extend, patch up and set up to my needs. I had limited (and bad) experience with Windows based servers, and on top of bad experience I did have to pay for the OS.
I don’t know what’s so hard to understand in my post but I find no other reason to try to defend my viewpoint since it’s super simple to understand. No offense, but it seems we’re not at the same wavelength here.

I agree, I have visited some companies’ websites that provide hosting for both Linux and Windows. I was shocked, the price is the same and in some cases differ but the diference is reasonable!

The reason I personally prefer PHP for web development is its simplicity.
It is true that literally anyone can pick it up and mash up some code, which has its merits and downfalls.
However, that does not mean the language itself is bad and that you can’t do something with it that some other (web-based) language can.

But if you look at some things that involve ASP.NET - you have to have windows based hosting. Windows OS costs money and require constant patching.
You also had to have windows + .NET framework (again, you have to cash out some money to have windows in the first place).
You are also tied in to .NET framework, which someone love and others despise.

You were also steered towards using MSSQL (even though you CAN use other databases), however MSSQL costs money.

I remember 5 years ago when I encountered a topic at one of programming forums where the OP had problems with resizing images in his newly-created ASP.NET application. It turned out, in order to enable image manipulation - you had to have a plugin of some sort (that cost money).

PHP has GD library or you can hook in into ImageMagick via OS calls or imagick class (on the other hand, you could do the same on Windows based machine if sys_ calls weren’t blocked somehow).

Bottom line is - in order to start with PHP programming you have to pay 0 for software fees.
In order to host php based website, you need some ridiculously small amount of money, and you get the MySQL db, ImageMagick and what not in order to start a small blogging website or forums.

In order to grasp simple programming concepts - you have to follow simple tutorials available both at or Sitepoint or any other website.

So the bottom line is - it is very cost effective and very easy to start with php.
Of course, many people are interested in just doing something rather than doing it properly, hence - we get terrible scripts that get popular.
However, that’s not language’s weakness.

The other usual argument that’s pro ASP.NET is the execution speed that trumps PHP’s execution speed, which is usually based on terrible examples.
There are ways of caching PHP’s OP code, plus there are ways to design applications in such way that PHP doesn’t have to handle huge amounts of data.
Pure logic implies that if the amount of data and complexity of calculations increase, the execution time increases, no matter the language.

I won’t get into the whole object model of languages available, that’s a topic for itself.
If I had to start out again, I’d definitely do it with PHP and not some Microsoft product that I have to pay with my soul in order just to have simple “hello world” application.

So those, 200+ patches I just installed on my Linux server last week and the week before that do not count? Get real. I’ve managed several Linux, Unix and Windows servers, all of them have constant patching all of them cost the about the same about. I pay more for utilities to keep a server running, making any initial cost of a server a moot point.

I would argue that weak typing is an inherent fault. Objects do not obey strict rules in regards to interaction and the rules are much more relaxed. PHP did NOT start as a programming language, its humble beginings were are as a templating language, therefore it does not adhere to strict rules that many other languages do.

“everything above binary has that.” Have you tried writing something in C, C++ hell even Java, Python and C# which are much higher level languages, but the barrier of entry is much higher.

The thing is though because PHP is so open in comparision to other languages you end with a bunch of people just thinking they can begin without any fundamental programming skills. That is one thing I could do without which doesn’t seem to be a problem with other languages as people choose to use .NET have some type of programming background and its just about the .NET way of doing things rather than stupid string manipulation or array questions that the person would know if they have actually read a book about programming. That is probably were most the misconception comes into play when comparing the ease of learning PHP over a language designed for a desktop environment. People just think they can download some open source solution and just start only realize it does take fundamental programming knowledge regardless if its PHP, JavaScript, etc. Its all programming so without fully understanding programming in its basic form is doing to yield disaster or in the case of this forum a bunch of basic questions about things that are covered in the fore-front of most basic programming books.

Mind using the enter key some, oddz. Mass of text not all that fun to read.

And you don’t have to use ASP.NET to make a web site, you can get down low like PHP if that is your fancy. Code everything from scratch in C# just like PHP. (I’ve programmed in PHP most of my career I know most of its in and outs. I only recently started learning C#)


Ok now test .net and php on linux…

As a stepping stone into the programming world, I would suggest the combination. Mainly because this is a stricly typed language, as opposed to PHP which is not.

PHP has a low barrier of entry, this coupled with a weakly typed language usually results in a perversion of programming. Thats not to say, that you can’t write good PHP code, you most certainly can. However, I personally feel that if you have a good base in another OO lanuage (C# or even Java) picking up PHP will be fairly easy.

To counter burminsky_pvs comments. The plus side of PHP is its online support, this is also its pitfall. By that I mean, because of its low barrier of entry there are plenty of people out there who offer a whole lot of bad advice about the language.

As for his comments on efficieny. I WOULD LOVE for you please for the love of God, prove the comment “That is the reason why PHP coding leads to better speed and even efficiency.”

PHP is NOT faster then ASP. PHP, is in its most primitive form loaded with every request, interpreted and then discarded. From a theoratical point of view ASP is faster. However, if PHP is done well, the differences are not great.

“Bear in mind that .Net has primitive types, type safety and these sorts of things that will make code faster than PHP can run it. If you want to do a somewhat unfair test, sort an array of one million random 64 bit ints in both platforms. ASP.NET will kill it because they are primitive types and simple array swill be more efficient than PHP’s associative arrays (and all arrays in PHP are associative ultimately). Plus PHP on a 32 bit OS won’t have a native 64 bit integer so will suffer hugely for that.”

PHP has a low barrier of entry, this coupled with a weakly typed language usually results in a perversion of programming.

Weak typing is not an inherent fault. It’s also not as simple as the word “weak” makes out.
As for “a low barrier of entry”, everything above binary has that.
As for perversion of programming … I’d have to say the worst I’ve ever seen is

Also, burminsky is probably a spam turk.

If you’ve never done any programming before, then PHP should be easy to get started with.

When you say “the language itself” you aren’t really talking about .net vs PHP. .net is different from the rest in that it is a framework that can be programmed in one of several languages (VB, C#, etc) whereas anything else you mention will be a language that has (usually several) frameworks to choose from (eg PHP has Symfony, Yii, etc; Python has TorboGears, Django, Pylons, etc). I think “easy to learn” puts a lot of emphasis on what you can easily google, what communities exist; and PHP would be up there (but do realize that also has a downside - you will find lots of dated/bad advice as well).

“Better for the future of web dev”? It depends what you mean. Career wise? Have a look at your local job boards. Other meanings of better would deserve a thread unto their own and there would be massive disagreements :S

“More facilities”? Each language can do anything the other can do, it is more a case of which one makes X task easier. This will mostly be handled by the framework you choose rather than the language.

Thank you for your reply. I do not care about hosting if it is for ASP.NET or for PHP, I can deal with this later. What is really important for me is the language itself. Which one is easier to learn? Which one is better for the future of web development? Which one provides more facilities than the other?


Web Dreamer

How so? I pay the same amount for my utilities and for bandwidth for all the severs I run regardless of what OS they have installed. Each one I set up requires the same addition to the utilities’ cost. There is no difference in the cost to run a Windows or Linux server. Furthermore, if the user already has a computer, it is most likely has Windows on it. Those who would be asking an entirely different question one specific either to Linux or Mac, or not one specific like this. Making your point of having to own a copy of Windows a moot point. The user in question has to also purchase hosting whether it be PHP or .NET driveled, again another moot point as both can be had for the same price. (For good hosting, not some child in his mother’s basement type hosting.)

PHP and .NET/C# both have free development tools.
PHP and .NET/C# both have free learning resources.
PHP and .NET/C# both have large communities.

I’m sorry, but more money is required to run a Windows server than a Linux one.
However, if you want to run Windows one and pay more for worse service - then have fun, I won’t tell anyone what’s better for them if it works good.
I’m not talking about managed hosting here, I’m talking about actually renting a server and sticking an OS on to it.

Go for ASP.NET. PHP is for every newbie kid and that is the reason why there are more PHP people than ASP.netters. If you want more money and prestige, go for ASP. There is no two ways about it. It is a question of supply and demand. Don’t listen most of the people here in the forum as they are biased towards PHP. I myself is a PHP developer, and a Microsoft hater but I would not advise anybody to learn any scripting language other than ASP.

Purely for programming pleasure though, my vote goes to Java. And Java has a web programming capability too in the form of Java Servlets and JSP. So you may want to ask which one, Java or, you should learn. Either one is good employability-wise but java would get my vote.

i prefer php, its free and super power full…
many big site use this language, e.g. fb


Guys, i’m confused now, which one should I pick up? :stuck_out_tongue: