1. Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Rep Power

    Why Use ASP When There is PHP?

    I'm not understanding this, so please explain it to me.

    Why do all the large sites like MSNBC use ASP when PHP is much better. Why use ASP When its slow, you have to pay for an expensive server to run it, and theres many other problems. I dont see why anyone uses ASP and there is so much support from people for php, ect.
  2. #2
  3. Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Rep Power
    UPDATE, I found this, it seems that ASP is just a comintation of other "microsoft" things like JScript, VBScript, it sounds harder. And whats with all this .net stuff??

    1. Speed Speed Speed
    The first time I ran a PHP script, I said to myself, "this is a Ferrari, so fast." I was using a slow 166 Mhz PC, but you can get a lot of fast mileage off PHP.

    ASP will probably never be as fast as PHP. ASP is built on a COM-based architecture. When an ASP programmer uses VBScript, he is running a COM object. When he writes to the client, he's calling the Response COM object's Write method. When he accesses a database, he uses another COM object to do so. When he accesses the file system, another COM object is called. All this COM overhead adds up and slows things down.

    In PHP modules, everything runs in PHP's memory space. This means that PHP code will run faster because there is no overhead of communicating with different COM objects in different processes.

    The following benchmark, where we execute a Select statement 40 times on Microsoft SQL Server 7 using PHP's MSSQL7 extension, PHP's ODBC extension and COM, will show you what I mean:

    PHP Querying MSSQL7 Seconds (lower is better)
    Using MSSQL extension 01.88
    Using ODBC extension 09.54
    Using ODBC via COM (ADO) 17.28
    Using OLEDB via COM 06.19

    Benchmark methodology

    When we access the database using PHP's ODBC extension, it's 9.54 secs. Using the COM interface to connect to ODBC adds a 80% overhead (17.28 secs) to ODBC.

    OLEDB is Microsoft's high speed COM technology for accessing databases. It is faster than ODBC, but when we use the PHP MSSQL extension we get a 200% increase in performance. So just tell a ASP programmer: No COM more speed.

    Of course there is some risk that a PHP module crash could affect multiple web pages. But remember we are still in the early days of the high speed Zend engine. Today we are still ironing out the kinks from the module based PHP engine.

    And this is where the benefits of the Open Source Model kick in. The constant peer-review and the world-wide test team allows the PHP team to create a production quality PHP engine much faster than any closed source company could.

    2. Superior Memory Management
    In ASP's model (in IIS 4), if an ASP file header.asp is included into 20 web pages, then 20 compiled copies of that header.asp are maintained in memory. IIS 5 has implemented an improved memory management model, but only programmers who are using Windows 2000 can upgrade because it is not backward compatible with IIS 4, and Windows NT 4.0 cannot run IIS 5. This means that most IIS web servers are still stuck with the inferior memory management model.

    This is unlike PHP, which only loads include files that are required.

    3. No Hidden Costs with PHP
    One of the things I hate most when buying anything is hidden costs. You buy a car and you have to replace the engine. You buy a house and have to retile the leaking roof.

    Well, buying ASP is a bit like that. Need encryption -- buy ASPEncrypt. Need email management -- buy ServerObject's QMail. Need file uploading -- buy Software Artisans SA-FileUp.

    All this is built into PHP for free.

    4. MySQL makes it cooler.
    PHP's integration with MySQL is simply fantastic. There are lots of PHP tools to manage and maintain MySQL databases. The feature set is complete compared to other databases. We have very useful functions like mysql_insert_id and mysql_affected_rows which are not available for other database products.

    ASP and PHP are both very good solutions for mid-range web sites. What makes PHP stand out is the tight integration with MySQL. MySQL is also tuned for mid-range web-sites, where selecting and pumping loads of data is more important than transaction support. This transaction support allows the programmer to synchronise updates on multiple tables; which the majority of web sites do not require.

    When we compare databases Microsoft Access is much slower than MySQL. SQL Server 7 and Oracle are nearly as fast, but much too expensive if you don't need the transaction support.

    19 April 2001 Update: Many database experts have told me how foolish I am to compare MySQL with Oracle and other high end databases. This comes from a fundamental misunderstanding of how most Web sites operate. Most Web sites serve thousands of Web pages a day, but perform fewer data updates. And a typical data transaction is simple single table update for user logins or forum posts. So a database with speedy SELECTs and lousy INSERTs and UPDATEs like MySQL is a good trade-off in this environment.

    5. Closer to Java/C++ Style of Programming
    OK, the benefits of this statement is an opinion.

    I agree that you won't convince a hard-core Visual Basic programmer to switch to PHP just because PHP has C or Java style for-loops, curly-braces and ->.

    But you could convince someone who likes C++ or Java that PHP is a better or easier language to learn than VBScript.

    PHP also has good support for modular programming in classes. Usage of classes is still rare in VBScript because of its heritage. PHP's common heritage with Java and C++ ensures a large body of programmers who uses classes all the time.

    6. No Show Stopper Bugs
    Have you ever asked Microsoft to fix a bug in ASP? If you aren't a large corporation like Boeing, the chances of getting that fix quickly are pretty low. And if it is a show-stopper of a bug, where nothing will work if this bug is not fixed, what are you going to do?

    With PHP, even if you don't have the expertise in-house to fix the bug, you can definitely hire the expertise. There are no show-stoppers in PHP. Your investment is protected by the Open Source nature of PHP.

    7. Cross Platform Migration Strategy.
    Microsoft is constantly tuning ASP. The next generation, called ASP+ is being previewed now. I have no doubt that they are fixing some of the criticisms I have mentioned.

    But there is also no doubt that Microsoft aims to lock you down to use their products.

    I used to be a Macintosh programmer. When Windows 95 came along, I switched, but most of my code was never ported over. It's still archived somewhere but I never do anything with it, much to my regret. I don't want the same thing to happen to my Windows code.

    So do you have a backup strategy in case Microsoft sinks? Don't forget that at one time Novell was nearly as dominant as Microsoft in the networking arena. Today everyone is ditching Novell. It might happen to Microsoft.

    I found my backup strategy. It's called PHP. I still program on Windows, but I know my PHP program will run on Solaris, Linux and many other operating systems. I have peace of mind.
  4. #3
  5. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Rep Power
    If you looked slightly harder around the web you could also find an article that is not written by a PHP affectionado, which would list the downfalls of PHP. I am not going to list them here, you found that page so you can find another :-)

    A major reason for choosing either is your hosting.

    Windows hosting = ASP / IIS Server

    Linux hosting = PHP / Apache Server

    Although thats not set in stone, its generally the way things work.

    Its horses for courses at the end of the day, but if you read biased articles like that so patently obviously is you are setting yourself up for a major dose of ignorance.
  6. #4
  7. No Profile Picture
    Standards User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Rep Power
    I'd reword your question like so:
    Why do all the large sites like MSNBC use ASP IF PHP is much better.
    Now some random points.
    Not ALL ASP hosts are expensive. I've never noticed, and I doubt many end-users would, much speed difference.
    ASP is readily available on most Windows machines out of the box via IIS/PWS. Therefore there's no searching around to find what you need, (not to mention sorting through all the *nix terms) and it's pretty easy to learn. Especially for database beginners, as Access is easy, and also widely available to most Windows users. ASP can also be used with MySQL, as I do on a few sites.
    I'd recommend trying it out. There are even a ton of free ASP hosts out there, if you don't feel like setting it up on your own box.
    I'm fairly new to ASP, and even newer to PHP, but I'm trying both before I come to the conclusion that one is "much" better than the other. It makes sense to try them and figure out which is better for you, rather than to judge something simply because its "microsoft".
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Canada - Egypt
    Rep Power

    I think it is support

    I think.
    When it comes to large corp. the main factor for choosing ASP over PHP is like what ralphuk100 said
    windows = ASP
    Linux = PHP

    For large corp. they buy the Windows server + they purchase support for it too. Which is something any manager for a large corp. wants to hear. "We are getting 2 years of support with this server".
    Specially if that manager is not very educated in software or web development.

    The idea of
    "There is a lot of articales and fourms on the web that will help us if we run with problems with our server"
    doesn't empress the manager much.

    That's just a personal opinion based on personal experience.
    I hope this is of any help to anyone.


IMN logo majestic logo threadwatch logo seochat tools logo