10 Reasons Why PHP is Better than ASP

A

Ali Bobo

1. PHP.NET the greatest API resource known to MAN
2. If you have a problem, someone will have already implemented a
solution in PHP for you
3. Syntax is better, closer to C, C++, and Java. Unlike VB where
anything goes.
4. To run ASP you need IIS on windows, which is not free, for PHP
however you need Linux and Apache which are FREE!!
5. Great built in support for ftp, email, graphics package GD2 and
also MySQL (also FREE).
6. PHP will run on Unix, Linux, Solaris and Windows. ASP is mainly
only Windows associated but you can use it on linux with additional
modules installed.
7. PHP code is much faster, ASP is developed on the COM based
architecture, this is an overhead for the server.
8. mod_rewrite, need I say more.
9. Advanced Perl-compatible regular expression functions and loads
of built in support for regular expressions on the whole.
10. Greater control over error handling, and more detailed error
messages.

http://www.hwhappy.co.uk/2006/11/30/why-php-is-better-than-asp/
 
T

Toby A Inkster

Ali said:
2. If you have a problem, someone will have already implemented a
solution in PHP for you

Although PHP is one of my favourite programming languages, I do think that
some of these reasons are not so good, so feel I should "correct" some of
them, or at least further elaborate.

Regarding point #2, yes, that's often the case, but half the time their
solution is junk and needs extensive rewrites to remove obvious security
flaws. The reason there's so many free PHP scripts out there is because
there's millions of PHP scripters out there. It may come as a shock to
some of you, but not all of them are geniuses.
3. Syntax is better, closer to C, C++, and Java. Unlike VB where
anything goes.

PHP's syntax is better because it's closer to C? If anything, similarity
to C's syntax should be classed as a disadvantage. C is a step up above
assembly, but that's all that can be said in its favour.

Of the C-like languages, C#, Java and Javascript are far more elegant in
syntax than PHP. But if you want to see a language with a truly nice
syntax, check out AppleScript.

Besides which, ASP.NET (the latest incarnation of ASP) is a container
format which supports the use of various different languages within it.
Sure, VB is common, but so is Javascript. Perl within ASP is not unheard
of. It's even possible to script PHP within ASP.
4. To run ASP you need IIS on windows, which is not free, for PHP
however you need Linux and Apache which are FREE!!

You do not need either Linux or Apache for PHP. There are various other
operating systems and web servers that will run it. I happen to do a lot
of my testing on Apache for Max OS X. PHP will even run on IIS on Windows.

Whatsmore, there are various alternative implementations of ASP, some of
which are free. However, much like with C#, a lot of people rely on
specific quirks and extensions of Microsoft's implementation, so the
result will not run on the alternative implementations.
5. Great built in support for ftp, email, graphics package GD2 and
also MySQL (also FREE).

MySQL is a pretty crummy database though.
6. PHP will run on Unix, Linux, Solaris and Windows. ASP is mainly
only Windows associated but you can use it on linux with additional
modules installed.

Contradicting point #4 yourself now.
7. PHP code is much faster, ASP is developed on the COM based
architecture, this is an overhead for the server.

COM-based ASP is pretty old. ASP.NET pages can be pre-compiled, allowing
very fast execution.

PHP scripts can be cached in a compiled form if you use eAccelerator or
similar, but this functionality will not be included in PHP by default
until 6.0 is released.
8. mod_rewrite, need I say more.

mod_rewrite is written in C, not PHP.
9. Advanced Perl-compatible regular expression functions and loads
of built in support for regular expressions on the whole.

VBScript as of version 5 (which is quite old now) supports regular
expressions, but they're pretty limited compared to Perl's regexs.
However, as I said earlier, ASP is not just limited to VBScript. Perl will
happily run within ASP, and Perl's regexs are certainly Perl-compatible!

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 17 days, 4:39.]

Gnocchi all'Amatriciana al Forno
http://tobyinkster.co.uk/blog/2008/01/15/gnocchi-allamatriciana/
 
T

Tim Slattery

PHP's syntax is better because it's closer to C? If anything, similarity
to C's syntax should be classed as a disadvantage. C is a step up above
assembly, but that's all that can be said in its favour.

I VASTLY prefer C, C++, java, e to VB or any of its variants. Of
course your can use Javascript for ASP pages, which removes this
objection.e to script PHP within ASP.
You do not need either Linux or Apache for PHP. There are various other
operating systems and web servers that will run it.

Exactly, that's what OP really mant to say. ASP is proprietary, it
runs only on Windows/IIS. PHP runs anywhere.
 
J

Juan T. Llibre

re:
!> ASP is proprietary, it runs only on Windows/IIS. PHP runs anywhere.

Not so.

Grasshopper enables you to produce .NET Web and server applications that
run on Linux & other Java-enabled platforms using ASP.NET 2.0 controls,
role-based security, and C# generics.

http://dev.mainsoft.com/
 
M

Mark

A couple of years ago, I was charged with producing a comparitive analysis of
ASP, ASP.Net and PHP. Have to admit the experience with PHP made me vow
never to use it again...

Toby A Inkster said:
Regarding point #2, yes, that's often the case, but half the time their
solution is junk and needs extensive rewrites to remove obvious security
flaws. The reason there's so many free PHP scripts out there is because
there's millions of PHP scripters out there. It may come as a shock to
some of you, but not all of them are geniuses.

There's that... And there's the fact that many of the modules written into
the php engine are not built by geniuses either. Many are not thread safe
and unless you're running in an apache-mode (every request siloed to a
separate process) you pretty much take your life in your hands.

And then there's the crappy release environment that comes with linux. The
test box I had was a version of linux that was about 9 months old at the
time. It came with php 4 from Redhat even though php 5 had been out a couple
of years by then. (a sys admin told me Redhat muddies the waters even further
by making their own mods to the "open source" packages they bundle, so their
versions aren't the same everyone else gets.

I was supposed to test php 5, since it was supposed to have great new
features, but you couldn't *get* an rpm for a version of linux 9 months old.
The user groups all said that it was *unreasonable* to expect an rpm for
linux that old. They wanted me to upgrade linux with a clean install. For
php.

So I tried downloading the source and building from scratch. About 1/3 of
the modules going into php wouldn't build from source. About a week blown to
debugging other people's great open source stuff.
MySQL is a pretty crummy database though.

MySql's not such a crummy database, but it does have a *lot* of quirks. You
pretty much have to throw out everything you ever knew about query
optimization for MySql. And to the OP's point, it's free.

Of course, the .Net framework has a lot of the other doodads the OP
mentioned in it, plus there's an open source community to fill in around the
edges.
COM-based ASP is pretty old. ASP.NET pages can be pre-compiled, allowing
very fast execution.

PHP scripts can be cached in a compiled form if you use eAccelerator or
similar, but this functionality will not be included in PHP by default
until 6.0 is released.

That was one of the interesting parts of my tests, actually. I didn't
spring for Zend Accelerator (which goes against the OP's point about
everything being free), so my timing numbers were pretty much php
out-of-the-box vs the others.

I found that as long as you could keep everything in the underlying c
libraries, php was really fast, but if most of your work was in the script,
php fell *way* behind ASP.Net, slightly behind ASP, finishing only ahead of
Mono which was a dog on all the tests.

Then there's the bastardization-of-perl (and perl is a bastardization of c,
bourne shell, sed and awk) syntax of php which I find personally repellent.

More recently, I went to a conference for SugarCRM, a product written
entirely in php. You heard the ususal open source mantras of "rock solid,
fast and free" but all the questions in every user group session were "why is
it so slow?" and "why don't you fix your bugs?"

Mark
 
A

Andy B

I had my experiences with php as well... it sucked.... In the time it took
me to create 20k worth of php scripts for a website, I have created a 19.5mb
website with better design and security. I was on a few mailing lists where
people claimed that php was "secure". From my results, it is about the most
open to hackers I can find. I had people tell me to keep all of the php
files "outside" the web root and it will be secure. If they didnt know, most
webhosts you pay for wont let you outside the web root. Anyways...off the
soapbox...
 
S

Steve

Tim Slattery said:
I VASTLY prefer C, C++, java, e to VB or any of its variants. Of
course your can use Javascript for ASP pages, which removes this
objection.e to script PHP within ASP.


Exactly, that's what OP really mant to say. ASP is proprietary, it
runs only on Windows/IIS. PHP runs anywhere.

oh so wrong!
 
L

Leon Mayne

Mark said:
A couple of years ago, I was charged with producing a comparitive analysis
of
ASP, ASP.Net and PHP. Have to admit the experience with PHP made me vow
never to use it again...

I code for a site written in PHP and although it is very fast, it's a
nightmare to work with. It's perfect for beginners and linux zealots who
code in their bedroom by themselves, but when you start trying to do team
development with it it becomes a nightmare.

MySQL is also fast and free, but so is SQL Express. The 4Gb database limit
hasn't been much of an issue to me yet. The stored procedure functionality
in MySQL is incredibly basic and irritating to use, and if you are stuck
with a MySQL <= v4 server then you'll have to use ad-hoc queries for
everything. Something I hate doing.
 
A

Anthony Jones

Leon Mayne said:
I code for a site written in PHP and although it is very fast, it's a
nightmare to work with. It's perfect for beginners and linux zealots who
code in their bedroom by themselves, but when you start trying to do team
development with it it becomes a nightmare.

MySQL is also fast and free, but so is SQL Express. The 4Gb database limit
hasn't been much of an issue to me yet. The stored procedure functionality
in MySQL is incredibly basic and irritating to use, and if you are stuck
with a MySQL <= v4 server then you'll have to use ad-hoc queries for
everything. Something I hate doing.

SQL Express isn't very scalable though so it wouldn't be useful on a busy
site. I don't know anything about MySQL but I doubt it has the deliberate
connection limit that Express has. If you need to deliver a DB intensive
site at minimal cost then an open source DB such as MySQL would be worth
consideration. However, the potential extra hours of effort to get a
reliable and perfomant solution when using something like MySQL as opposed
to SQL Server standard ought not be overlooked as cost.
 
L

Leon Mayne

Anthony Jones said:
SQL Express isn't very scalable though so it wouldn't be useful on a busy
site. I don't know anything about MySQL but I doubt it has the deliberate
connection limit that Express has. If you need to deliver a DB intensive
site at minimal cost then an open source DB such as MySQL would be worth
consideration. However, the potential extra hours of effort to get a
reliable and perfomant solution when using something like MySQL as opposed
to SQL Server standard ought not be overlooked as cost.

No, you wouldn't use SQL Express on a big site, unless you wanted to start
small and when the money started coming in and the database size increases
you could buy SQL Server Standard (or workgroup) and install it, and then
migrate your database onto it.

There are better free open source databases than MySQL though, like
http://www.postgresql.org/ people just tend to advocate MySQL because it's
easier to use.
 
A

Anthony Jones

Leon Mayne said:
No, you wouldn't use SQL Express on a big site, unless you wanted to start
small and when the money started coming in and the database size increases
you could buy SQL Server Standard (or workgroup) and install it, and then
migrate your database onto it.

Its not the size that is really important, its the concurrent connection
limit. You would need put extra effort in upfront to ensure your site coped
with Expresses limitations gracefully (so that will be cost). Also how well
a site responds as it gets busy may well be a factor in whether it is
successful or not in the first place. It would be shame if the use of
Express was the reason it failed to succeed.

You might use SQL Express for a beta but should consider very carefully
whether you want public deployment to run on Express.
There are better free open source databases than MySQL though, like
http://www.postgresql.org/ people just tend to advocate MySQL because it's
easier to use.

True but then the extra effort needed to use postgresql is again cost.
 
A

Ali Bobo

Although PHP is one of my favourite programming languages, I do think that
some of these reasons are not so good, so feel I should "correct" some of
them, or at least further elaborate.

Regarding point #2, yes, that's often the case, but half the time their
solution is junk and needs extensive rewrites to remove obvious security
flaws. The reason there's so many free PHP scripts out there is because
there's millions of PHP scripters out there. It may come as a shock to
some of you, but not all of them are geniuses.


PHP's syntax is better because it's closer to C? If anything, similarity
to C's syntax should be classed as a disadvantage. C is a step up above
assembly, but that's all that can be said in its favour.

Of the C-like languages, C#, Java and Javascript are far more elegant in
syntax than PHP. But if you want to see a language with a truly nice
syntax, check out AppleScript.

Besides which, ASP.NET (the latest incarnation of ASP) is a container
format which supports the use of various different languages within it.
Sure, VB is common, but so is Javascript. Perl within ASP is not unheard
of. It's even possible to script PHP within ASP.


You do not need either Linux or Apache for PHP. There are various other
operating systems and web servers that will run it. I happen to do a lot
of my testing on Apache for Max OS X. PHP will even run on IIS on Windows.

Whatsmore, there are various alternative implementations of ASP, some of
which are free. However, much like with C#, a lot of people rely on
specific quirks and extensions of Microsoft's implementation, so the
result will not run on the alternative implementations.


MySQL is a pretty crummy database though.


Contradicting point #4 yourself now.


COM-based ASP is pretty old. ASP.NET pages can be pre-compiled, allowing
very fast execution.

PHP scripts can be cached in a compiled form if you use eAccelerator or
similar, but this functionality will not be included in PHP by default
until 6.0 is released.


mod_rewrite is written in C, not PHP.


VBScript as of version 5 (which is quite old now) supports regular
expressions, but they're pretty limited compared to Perl's regexs.
However, as I said earlier, ASP is not just limited to VBScript. Perl will
happily run within ASP, and Perl's regexs are certainly Perl-compatible!

Interesting points you've made.
Thank you
 
C

Chris Shepherd

Mark said:
A couple of years ago, I was charged with producing a comparitive analysis of
ASP, ASP.Net and PHP. Have to admit the experience with PHP made me vow
never to use it again...
[...]
After reading your post it seems like the absolute worst-case scenario -- a
person with little to no actual knowledge of how to run (or write apparently)
PHP inside an unfamiliar environment is tasked with writing an objective analysis.

If you had such issues with RedHat, why not just slap it on Apache on Windows?

I'm all for pointing out the flaws in a particular language, but that's not
really what you did, and it's very clear from the wording you use you were
biased against it from the beginning.

The real issue though is that threads like these serve very little purpose.
Posting how PHP is better than ASP on an ASP discussion group is obviously just
going to generate posters saying the opposite, just as you'd expect if the
situations were reversed. I have gripes about both PHP and ASP because I'm
familiar with both and frequently write for both.

Call me crazy, but I use whatever makes sense at the time. If I'm developing and
my target platform is Linux, I'm likely to invest my time into solutions that
I'm familiar with and work well on that platform. It boils down to using what works.
I think any reasonable developer would do the same.


Chris.
 
M

mark4asp

Leon said:
No, you wouldn't use SQL Express on a big site, unless you wanted to
start small and when the money started coming in and the database
size increases you could buy SQL Server Standard (or workgroup) and
install it, and then migrate your database onto it.

There are better free open source databases than MySQL though, like
http://www.postgresql.org/ people just tend to advocate MySQL because
it's easier to use.

Not because it's easier to use, but because there are such a huge
number of hosts offering very cheap LAMP hosting.

Postgresql had been around for donkey's years but dinosaur web hosts
continue to offer only mySQL. Laught you got to, to stop from crying.
Oh yeah, and why no Firebird database hosting? Given that both
Firebird and Postgresql are as free as mySQL and both vastly superior
it seems very perverse that web development should be determined why
what cheap web hosts offer rather than what developers want!

I looked at php and thought it better than asp but not a patch on
asp.net, especially now that we have the MVC. If I had to do fully open
source development I would use Ruby on Rails which is vastly superior
to php.
 
J

Juan T. Llibre

re:
!> SQL Express isn't very scalable though so it wouldn't be useful on a busy site.

I don't know what you call "scalable", but I can tell you that I was boxed on
the ears by the SQL Server 2005 program manager for saying precisely that.

The PM said that SQL Express could take a large number of concurrent hits and not choke.

See Joel on Software's take on this :

http://discuss.joelonsoftware.com/default.asp?biz.5.481914.11

<quote>
SQL Server Express 2005 _is_ the real SQL server. Unlike MSDE, its throughput is not crippled by a "governor"
(see http://msdn2.microsoft.com/en-us/library/ms165672.aspx and
http://blogs.msdn.com/euanga/archive/2006/03/09/545576.aspx ).

The Express edition has limits on database size, ram usage (affects caching etc) and
number of CPUs (it cannot take advantage of multiple CPUs). If you can live within
those limits (and many systems probably can) then it will meet your needs just fine.

P.S. It also lacks some advanced features (e.g. full text search)
See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sseoverview.asp
</quote>

I.O.W., a site would have to be a *really* busy site for it to outgrow SQL Express.
 
J

Juan T. Llibre

re:
!> Its not the size that is really important, its the concurrent connection limit.

There are *no* connection limitations with SQL Express.

MSDE had a governor which limited concurrent connections to 10
(it placed concurrent connections above 10 in a queue), but SQL Express
doesn't have a governor.

SQL Express will process as many concurrent
connections as the server's cpu/ram/bandwidth allow it to.
 
J

Juan T. Llibre

re:
I can't find the documentation on that... can you point the way?

There isn't any documentation on that, because there is no such animal.

SQL Express doesn't have a governor controlling concurrent connections.
MSDE has one, but SQL Express doesn't.
 
M

Mark

Hi Chris...

Chris Shepherd said:
After reading your post it seems like the absolute worst-case scenario -- a
person with little to no actual knowledge of how to run (or write apparently)
PHP inside an unfamiliar environment is tasked with writing an objective analysis.

You're right, I had no enthusiasm for php from the get-go. As I said at the
end, I've always thought it a syntactic abomination. As another friend put
it, perl and php are what you get when you have humanities majors designing
languages. No real coherent thought detectable in the design.
If you had such issues with RedHat, why not just slap it on Apache on Windows?

First, because I had conflicting mandates, not of my choosing. Management
dictated Redhat *and* the version of php and supplied the box.

Second, I brought it up because the rabid linux-ophiles tend to downplay
what a chaotic mess software distribution is in their sphere. As I said,
they seem to think "reformat your drive and install a newer version of linux"
is a reasonable response to a request for an rpm of a software package.

And my experience with php was a little worse than average (1/3 of the
source packages not building) but in general I've found at least 10% of
source packages you pick up don't build and then you're stuck with debugging
someone else's software. Or you get one of these software bundles that says
"I just depend on these 10 other open source packages you have to have before
you build me..." which increases your chances that you have to debug at least
one of them because the crap won't build.

When you go to linux users' groups with questions on why the crap won't
build, you usually get "RTFM, jerk!" or "Not my problem, it built on *my*
machine."

Paradoxically, you often have much better luck just grabbing an installer
for the windows version of these things than the original linux one.

Using php and apache as examples, that's especially true. Because php for
windows is organized with dlls, it's so much easier to slot in the extensions
you want to use. The package for php on linux doesn't use so's; you have to
build one honking executable. If you want to add a module, you have to
rebuild the php engine.

I admit I haven't made so many points about the language as what's under the
hood, but half the OP's points were unrelated to the language as well.
The real issue though is that threads like these serve very little purpose.
Posting how PHP is better than ASP on an ASP discussion group is obviously just
going to generate posters saying the opposite, just as you'd expect if the
situations were reversed. I have gripes about both PHP and ASP because I'm
familiar with both and frequently write for both.

Yeah, the OP was obviously trolling. This thread has made some interesting
points, though.

I'm less familiar with php than ASP, and I suppose I should also mention
that I consider VBScript (and vb) a syntactic abomination too. When I do
ASP, I usually opt for server-side jscript if I'm not using ASP.Net and C#.
There are only 2 features I can think of that work better in vbscript than
jscript.
Call me crazy, but I use whatever makes sense at the time. If I'm developing and
my target platform is Linux, I'm likely to invest my time into solutions that
I'm familiar with and work well on that platform. It boils down to using what works.
I think any reasonable developer would do the same.

I agree with the same basic sentiment. Use what works where you are. I
haven't had to work in Linux for a while, but the big disappointment for me
was that Mono was such a dog. If it worked at all reasonably, it would be
nice to have a good implementation language cross-platform, but it's
performance was so bad there was no way it could be considered for anything.

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top