In order to run, ASP programs require a Windows platform server with IIS installed. Setup can be costly, and changing servers if necessary incurs additional cost. ASP also requires an additional setup cost because database connectivity is achieved through MS-SQL, another program that must be purchased. PHP is free and runs on Linux, a free platform, using MYSQL for connectivity, also free. The cost of ASP does not end with initial investment. Every upgrade will cost more, and upgrades are crucial. PHP is, and will always remain free. Cost may be the most significant difference between ASP and PHP.
In terms of speed, PHP wins. PHP utilizes its own memory space, where ASP accesses COM based server architecture, making PHP code leaner and faster.
ASP also has limited compatibility issues. It runs only on a Linux server installed with ASP-Apache. PHP is more adaptable, and can run on Linux, Unix, Solaris or Windows. Most servers are set up to integrate with PHP.
Since PHP is an open source project, many additional components, upgrades and tools are also available free for download. This is not true of ASP. Additional functionality, some of it considered standard in PHP, must be purchased as add-on components for ASP. This makes PHP more flexible and extensible in general than ASP.
The base code and syntax of PHP is very similar to C/C++, still considered the most powerful and flexible language by many programmers. ASP is more closely related to another Microsoft product, Visual Basic.
Each language is powerful and extensible. The decision for most is dependent on available tools, cost factors and programming strengths of developers involved, but in head to head comparison between ASP and PHP, PHP is the clear winner on most fronts. PHP also has the advantage of being a creative driven project as opposed to a commercial-driven endeavor. Programmers contributing their expertise work on what they feel to be most important, most interesting and most useful, with little regard to what might be most commercially viable.