Advantages/Disadvantasges/Differences between ASP and PHP?

Discussion in 'OT Technology' started by GotVtec, Feb 19, 2004.

  1. GotVtec

    GotVtec 8th World Wonder

    Joined:
    Mar 14, 2000
    Messages:
    575
    Likes Received:
    0
    Location:
    Omaha, NE
    JUst looking for info on the two languages. When to use one compared to the other, why use one at all, which has best database interaction, and other good info about the two.
     
  2. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    My comparisons are with ASP and not with .NET flavor ASP.

    ASP runs on IIS only. (Chillisoft has an ASP knockoff which I think is Perl driven - either way, it doesn't support all the features of ASP from what I've read)

    PHP runs on IIS and just about anything else.

    PHP v4 is not object minded. It can do objects, but if you're looking for hardcore OOP, PHP v4 isn't going to do it for you. In theory, version 5 will. ASP is pretty OOP friendly.

    ASP comes in two flavors: JScript and VBScript (.NET may bring additional languages to the table such as C#). PHP just comes in PHP. Although you can have PHP tap the power of Java.

    Both (when running on a Windows box) can make use of COM objects.

    ASP has ADO built in. PHP has a pretty well established open source ADO library. Although its not built in, it does give PHP ADO functionality.

    ASP has good error handling. Try/catch is available to gracefully work around problems. PHP v4's handling isn't as friendly or powerful. I'm not able to comment on v5 and what it can do.

    Infinite loop PHP and by default it will stop the problem script in 30 seconds. No other actively running scripts (or servers) are harmed when this happens (unless your PHP script is uber-nasty and hammers the server). ASP will hose IIS and will not free it until IIS is restarted (they fix this for IIS v6?)

    PHP has a very active development team and bugs and security issues are fixed in a timely manner. Your mileage will vary with ASP.

    Its easy to add and develop modules for PHP, such as the GD library (for image manipulations). The only thing I can think of that comes close is COM objects (I'd be curious how many of these COM objects would be free/open source).

    PHP has a boat load of functions for string and date handling. PHP also has 2 flavors of regular expression parsing (regular and Perl flavor). PHP also provides easy access to network functionality. Need to read an HTML page on another server? No problem with PHP (fopen, curl, fsocket, socket). Want to read it with ASP? I believe you have to create a SOAP/XML interface or create an IE object.

    Requiring a chunk of cash, PHP can be compiled/optimized for the Zend engine. This will increase PHP's performance and secure your PHP scripts (its sort of like creating a binary).

    Raw speed? Tough call and I'd say its a pretty even match. Development time-wise, I'd say PHP wins. It has a ton more short cuts and tricks you can do (assuming you know them or are willing to look them up on php.net).

    PHP also has php.net for documentation and notes. ASP has Microsoft's MSDN which is cute (and now almost works in Mozilla), but it doesn't have the user feedback and ton of working code examples and work arounds that PHP has. This alone can help make or break a project deadline (in my opinion at least).

    I've tried to keep this objective without pointing fingers at one or the other. They both get the job done. Which is my favorite? Easily its PHP. I need database access, string and date handling, speed, and reliability. I have yet to run into the kind of issues I saw with ASP when I was doing that for several years. Do I need the OOP that ASP has? Not really. I do use OOP with PHP, but its mainly to organize mildly complex data structures which is within the realm of version 4.

    If all you have is IIS, then ASP is the way to go. If you can get Apache on the Windows box, give PHP a whirl. If you're on anything else, then PHP would be the way to go...
     
  3. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    Astro makes good points. My personal choice between ASP (pre-.NET) and PHP would easily be PHP. I do enjoy ASP.NET and all it has to offer. My only problem with ASP.NET and .NET in generally is that you must be running Windows for it to work.
     
  4. samm

    samm Next in Line

    Joined:
    Dec 22, 2000
    Messages:
    2,630
    Likes Received:
    0
    Location:
    San Jose, CA
    PHP is free and you don't have to use a Microsoft based solution.
     
  5. VBGOD

    VBGOD Guest

    I have no problem with running Windows. :cool:

    By the way, does PHP work on a Window machine right out of the box? I know that JSP didn't.
     
  6. Diablow

    Diablow Guest

    I've ran PHP on a Windows machine right out of the box. Just some install and web server crap to take care off :)
     
  7. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    I've setup and run several WAMP configs (Windows + Apache + MySQL + PHP). I've setup W2k Pro and Win98. For testing and development, its not a bad way to go. For production, I'd recommend a LAMP setup (Linux + all the above).

    You can run PHP as an ISAP module. The module allows PHP to integrate pretty nicely with IIS. Of course, you inherit all the IIS issues. Check out php.net for docs and downloads for Windows.
     
  8. Jericho

    Jericho Active Member

    Joined:
    Oct 21, 2002
    Messages:
    34,140
    Likes Received:
    0
    ASP can use more than VBscript and Jscript, I'm using it now with Python, I think you can use it with Perl too and probably a bunch of other languages.
     
  9. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    A couple of weeks ago I would have agreed.

    We run a software download server for the students for Microsoft software (WinXP, Server 2003, VS.NET, etc), IBM Websphere 5.1, and Rational Rose (probably the most demanded by students). As you can imagine, during the start of a semester our download server gets slammed by students. This semester is a great example. We had originally setup a single machine which is a dual 500mhz Xeon with a GB of RAM or so, Win 2003 Server with IIS 6, SCSI drives, on a 100Mbit network. Keep in mind this server did nothing but serve up files via HTTP. We constantly kept having students come to us complaining they couldn't download software. Every time we checked, IIS had crapped out and dropped the current connections. So then we pulled in a second server exactly like the other and setup load balancing within Windows hoping this would even out the load. Same results, the systems kept crashing.

    What was our fix? We installed Solaris 9 on an Ultra 5 (I *think* it was a 5) and loaded up Apache. That system never crashed and remains running as of today. No software updates, no security holes, no reboot every night at 3am to keep it running smooth, very low scale hardware, and 100% uptime and reliability. I would have never believed that a load balanced setup with 4 500mhz Xeon processors and Windows 2003 Server would have been beaten so badly by a single Sun machine that you can buy on ebay for $99 (http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=3079288081&category=20328).

    PHP doesn't run on IIS out of the box, no. But it's pretty simple to setup. I did so earlier this week on IIS 6.
     
  10. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio

    You referring to ASP .NET or just regular ASP? If it was regular ASP, please share the setup info and what's all involved to persuade ASP pages to be parsed as another language...
     
  11. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    The Ultra5 was a powerful workstation back in the day (if I'm remembering correctly). I have an Ultra10 and by today's standards, its a little sluggish.

    At the Microsoft shop I was at, we saw the same thing - hammer the servers and IIS freaks out. Because they were a Microsoft shop, they weren't going to try any other software solution like Apache or Linux.
     
  12. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    I don't code ASP, but from my experience with ASP and PHP, I can say PHP has a function for practically everything, whereas ASP does not. (Unsure of .NET)
     
  13. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    whats the main difference between a server machine that you build or a server machine like monkey posted?
     
  14. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    Money and support.
     
  15. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    well aside from support why would you pay more money for a server which you can build yourself for a cheaper price?
     
  16. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    I don't think I've seen anyone build an AS400 or any Sun machines from parts before. :p

    For the Dell systems, our University is partnered with Dell (and Apple) so we get decent prices to begin with, plus the support is huge. If something fails, we are aired a part next day and then send back the failed part. That service alone is worth the cost of the Dell systems.

    Honestly, you just don't see medium to large scale businesses building their own servers. I'd love to hear of any business of that size that runs their systems on home built servers. Our data center has about a million dollars in equipment (and that's just our IS department, the University data center is freakin amazing) and you just don't trust something like that to homemade machines.
     
  17. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    When you have the money, it doesn't make sense to save a couple hundred dollars on a home built machine. Dell, Compaq/HP, Sun, and IBM put together systems they've stress tested and they back by putting their name on their machines. They then go and add support like a warranty and service level agreement which ensures if something breaks, they'll do something about it. They've also got the tech support and onsite support worked out so they quickly solve your problems.

    If you're a small shop, then home built is an attractive way to go. But its attractive because you pay less, but you take on more risk (but it may be risk you're willing to afford versus cold hard cash which you can't afford). Large businesses have the cash, yet they can't afford to have down time (because each minute is worth money).

    With home builts, its all about risk. As you tend to pay less, you take on more risk.
     
  18. Jericho

    Jericho Active Member

    Joined:
    Oct 21, 2002
    Messages:
    34,140
    Likes Received:
    0
    I'm talking about regular ASP. ASP is language neutral and will integrate with any language that can access COM.
    You can download Mark Hammond's win32all extensions for python and register Python with ASP yourself. I know you can download the ActiveState python distro, ActivePython and it will register python with ASP.

    I believe the perl equivalent is called PerlScript and also comes with Activestate's ActivePerl distro.
     
  19. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    Ok, this can be chalked up as a feature of ASP - it supports more than 1 scripting language. But by definition, PerlScript and X other languages are available as ASP because of ActiveX in the web server itself (docs). Which could be similar as saying Apache has modules such as Perl and PHP which can be dynamically loaded and used as scripting languages. For arguments sakes, I'm thinking we keep it to PHP vs ASP (default languages JScript and VBScript). Otherwise this could easily go off topic...
     

Share This Page