PHP vs ASP. NET front vs. 2_php tutorial

Source: Internet
Author: User
PHP and ASP. NET face each other. Last article: PHP vs. ASP. NET (1) security comparison ASP. NET officially requires you to use IIS. Unfortunately, IIS is vulnerable to attacks for a long time, which makes it difficult for many administrators to answer the previous article: PHP and ASP. NET (1) security comparison ASP. NET requires you to use IIS. Unfortunately, IIS is vulnerable to attacks for a long time, which makes many administrators reluctant to deploy it to process Web sites. These vulnerabilities are caused by Microsoft defects or because IIS is the target of a hacker's attack and do not matter: These systems have a history of being hacked or attacked. PHP also runs on Apache. Apache is fast and open-source, and has a good security record. In addition, as I mentioned, Apache can run on many platforms. If you are considering ASP. NET but want to use Apache as an Internet portal, you are lucky to have some options. First, you can use Apache to forward requests to IIS running on another computer. Apache then processes static content and sends the aspx content to the IIS server (not exposed to the Internet ). However, if you want to use Apache to host ASP. NET, some options are provided, which may or may not be supported by Microsoft. As the final option, Project Mono with Ximian is dedicated to building an open source code module. Browse the www.go-mono.com for more information. One of the first considerations when using PHP or ASP. NET for database Encoding examples is the connection to the database. However, using ASP. NET is more complex because you can select any language from many alternative languages. Of course, these code examples must be embedded into HTML pages and instantiated classes. However, the following information will help you understand the encoding style of the two. PHP 5 and Oracle connection below is a PHP 5 class, which provides an Oracle connection and disconnection routine to demonstrate the use of PHP 5 (you can also use other drivers (such as ODBC drivers) and common database interfaces). a method for connecting to Oracle is as follows: class oracle_object {protected $ theDB; protected $ user; protected $ pass; protected $ db; function _ construct ($ u, $ p, $ d) {$ this-> user = $ u; $ this-> pass = $ p; $ this-> db = $ d;} function db_open () {$ theDB = @ OCILogon ($ this-> user, $ this-> pass, $ this-> db ); db_check_errors ($ php_err Ormsg);} function db_close () {@ OCILogoff ($ theDB); db_check_errors ($ php_errormsg);} function _ destruct () {print ("so long... ") ;}} ASP. if you want to use VB. NET (Visual Basic is Microsoft's default. NET programming language) and Oracle connection, please take a look at this example from MSDN: Imports System. data Imports System. data. oracleClient Imports Microsoft. visualBasic Class Sample Public Shared Sub Main () Dim oraConn As limit L EConnection = New OracleConnection ("Data Source = MyOracleServer; Integrated Security = yes;") Dim guest MD As OracleCommand = New OracleCommand ("SELECT CUSTOMER_ID, name from demo. CUSTOMER ", oraConn) oraConn. open () Dim myReader As OracleDataReader = external Md. executeReader () Do While (myReader. read () Console. writeLine (vbTab & "{0}" & vbTab & "{1}", myReader. getInt32 (0), myReader. getString (1) Loop myRea Der. Close () oraConn. Close () End Sub End Class to make a choice. if you have not decided to use PHP, I can assert that the advantage of PHP far exceeds its weakness. (See the summary in Table 1 .) These benefits are attributed to price, speed and efficiency, security, cross-platform applicability, and open source code opportunities. Its only weakness is the lack of a pure and perfect OOP implementation. However, this is a small drawback. Although the language structure is indeed helpful, good coding is ultimately brought about by practice, execution, good habits and norms. Table 1 PHP 4 PHP 5 ASP. NET software price free platform price FREE $ strong speed, weak efficiency, strong security, strong platform, strong weak (only for IIS) any win32 Platform (for IIS only) provides source code, whether it is abnormal, whether it is OOP weak and strong price. Here, we should not simply consider the initial investment-which is obviously free for PHP-as well as the cost of implementation, maintenance, and debugging. For PHP, you may need to purchase the Zend optimization engine. However, with ASP, you will invest in it from the very beginning, and you will also pay for additional technologies, such as libraries that perform graphic processing. However, in the long run, PHP will not force you to upgrade and charge you more license fees. Everyone who has been familiar with complex licensing knows that many companies spend a lot of time and money just to ensure compliance. In addition, you may receive different responses when fixing errors. Of course, this will be converted into time, and time will be converted into the overall development cost. Speed and efficiency. As I mentioned earlier, ASP. NET is a framework that allows you to use various programming languages. In addition, it is said to have an excellent object-oriented model. Although all of these are true, it is unfavorable when considering the speed. For the above reason, running ASP pages in ASP. NET requires more code than running equivalent PHP pages in the PHP engine. PHP is a "fast and rough" solution that is designed to complete the work. Although it has improved a lot of robustness since versions 2.0 and 3.0, it still retains the high-speed method of core optimization. Speed is not the only factor to consider. Memory usage is also important. Security. ASP. NET runs on IIS, and IIS has been attacked countless times-as confirmed in the IT news report every other week. IT has become a burden. In fact, despite its huge investment in sales promotion, many IT professionals still refuse to use IIS Web servers to open their networks. PHP uses Apache. Apache has proven fast, reliable, and secure records. Please visit www.securityfocus.com for more information. Cross-platform applicability. ASP. NET runs on IIS and starts to run on Apache (Apache can run on many platforms ). PHP was designed to work with Apache from the very beginning, so you have many proven and reliable server platforms to choose from. Open source code opportunities. Open-source code does not only rely on whimsical programmers or companies that want to save license fees. When you handle software errors, open source code may become a real godsend. When PHP or ASP. NET is used, you will have a large user group. they use software and may encounter errors. With ASP. NET, these errors must be notified, repaired, tested, and eliminated in a new patch or version. However, PHP patches can be quickly patched and released. Anyone who has witnessed the development of open source code knows that new versions and patches are usually released within a few days rather than just weeks or months like commercial software. If this is not fast enough, you can fix the problem yourself (if necessary ).

Protocol vs. ASP. NET (1) security comparison ASP. NET officially requires you to use IIS. Unfortunately, IIS is vulnerable to attacks for a long time, which makes it difficult for many administrators...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.