Six reasons for PHP incompetence in large systems)

Source: Internet
Author: User
Tags pdflib what debugging shared hosting
The six reasons for the incompetence of PHP in large systems (in the discussion) This article has caused a lot of controversy. It seems that PHP has many supporters. However, looking at PHP from one side is not a problem. From php3 to php4 to PHP5, and then to PHP6, PHP is becoming more and more complete and more powerful. Six reasons for PHP incompetence in PH large systems)

This article has caused a lot of controversy. It seems that PHP has many supporters. However, looking at PHP from one side is not a problem.

From php3 to php4 to PHP5, and then to PHP6, PHP is becoming more and more complete and more powerful. PHP is an open-source project, including a descriptive language engine that simplifies programs, a large link library, and a company dedicated to PHP development, for example, Zend has a set of PHP products, programming tools, and technical support services. In particular, cross-platform features will make it shine on the linux platform. Java class libraries can be used directly to directly call programs written in perl/c and other languages to enhance its scalability. The increasingly mature MVC development framework enables it to adapt to enterprise-level large-scale application development. In addition, it is born with powerful database support capabilities. It did win the applause of many users!

However, I would like to look at the reasons why PHP may be incompetent.

1. the application scope is still limited.

Compared with Java, PHP has many limits on its availability. it can only be used on network servers. Unlike Java, it can also be used on network servers, PCs, mobile phones, chip cards, or other devices. Remember the reason why an old friend gave up php: "First, you need to write a $ symbol before each variable ;?? Second, because it is not a compilation and execution method ;? Third, object-oriented features are not strong ." For example, php exits after running oop once, and re-creates o next time to continue inheriting ..... Note that each request cannot use the previous result. the next request must be initialized from the beginning. The root cause of many problems lies in apache.

Another one: "Maybe the current php ?? IDE is not very good, and it is difficult to get started with others ." Although the new version has added object-oriented functions, there are still many improvements to be made in comparison to mature Java. So some people can conclude that (1) there is a lack of extensive use, so Microsoft will discuss with you the migration from PHP to ASP. Net. (2) lack of support from large companies. for example, PHP has only three of the six titles on the homepage of the open-source project of IBM's development center. (3) the lack of heavyweight applications, such as Google and Yahoo using PHP (not all products) is a blind game. Of course, I know that Taobao.com is also made by PHP.

2. debugging is not very convenient.

The process working mode on apache. Apache creates a sub-process to process every php request. in this way, it is difficult to implement a connection pool. data sharing between processes can only be achieved through files and databases, with a high overhead, of course, the speed is not low.

I would like to state the speech of a netizen: "debugging is too complicated without good development tools. Although zend is good, it is a competitor of. There is no powerful Visual development tool. In other words, if so, I absolutely choose PHP ." This seems to be a similar situation in the early stage of Java. Maybe, in the near future, we will see good debugging tools. The problem is that it is not quite satisfactory yet, especially for large systems.

Another problem is the use of shared memory. I don't know why it is so complicated to directly use php to operate shared memory, and the speed is actually slower than directly operating disk files.

3. security loopholes in mainstream versions

Read a recent news, andPhp pdflib extension bypasses open_basedir security restriction vulnerability. Affected systems: PHP 5.3.0.The PDFLib extension used by PHP does not correctly force basic PHP configuration instructions, which allows attackers to bypass open_basedir to restrict unauthorized file writing. This vulnerability occurs only when multiple users can create and execute shared hosting configurations for any PHP script code. In this case, open_basedir limits that users should be isolated from each other.

While adding some new features, PHP V6 also deletes some functions and features in previous versions. Most of the deleted items, suchregister_globalsAndsafe_modePHP is widely regarded as "vulnerable" because they may lead to security risks. Of course, PHP configuration is very flexible. ini, httpd. conf ,. htaccess file (AllowOverride All or Options must be set in this directory), you can also use ini_set () and its specific functions in the script program to set. You can use the phpinfo () and get_cfg_var () functions to obtain the values of the configuration options.

4. the stability of large systems and the style of a language can be said by someone (also a question for PHP readers): "Large systems are still used. net or jsp, not because php is not reliable, because the development of php is uneven, and the development mode of php is not fixed. based on your questions, if it is developed by many people, you must have poor control .. Net or jsp is relatively easy to control and can make the program structure clear. there will be no major problem for secondary development or programmers ."

Bruce Eckel, a veteran computer writer, also said: "You often find many PHP-coded code errors, but these codes are often copied to each other, but no one has to seriously analyze and study them. These codes are usually written by programmers who are used to copying code from each other. the poor quality of these codes is because these programmers are not used to asking why and do not like to understand the principles, just use it." To make everyone credible, let me release his photos.

?

Naturally, as an ordinary reader, there will be a focal point: is PHP promising? What's the reason you say you have a future? 5. explain the running mechanism of PHP

Perhaps the most painful part for experienced PHP programmers is the interpretation and running mechanism of PHP. This running mechanism allows all related resources to be recycled after each PHP page is interpreted and executed. That is to say, PHP cannot make an object resident in memory at the language level. In PHP, all variables are page-level. whether it is a global variable or a static member of the class, they will be cleared after the page is executed. Take JSP as an example. in JSP, the scope of Java Bean has four valid values: Page, Application, Session, and Request, which correspond to the Page, program, Session, and Request respectively. However, in PHP, only Page has one lifetime.

In PHP, to share data between pages, manually save the variables to the predefined global variables $ GLOBALS or $ _ SESSION. PHP stores these variables in a file so that they can be read at the next page execution. However, this method has great limitations. in addition to low efficiency, it cannot save variables that reference external resources, such as files, sockets, and database connections, these resources need to be cached most.

This makes many advanced models and technologies unusable. For example, even the simplest Singleton mode cannot be applied in PHP. Although Singleton code can be written in PHP, because PHP does not have a real global static variable, a new object will be created every time the page is executed, this completely loses the meaning of Singleton. This also makes the complex OR Mapping technology difficult to apply, because there is no object cache mechanism, OR Mapping overhead has made this technology meaningless.

6. The future is unknown. How long can open-source business models last?

For PHP developers, the importance of Mysql is obvious. Bruce Eckel, a veteran computer writer, believes that PHP is mainly used in combination with databases to handle all consistency issues. Therefore, most people only care about accessing data from databases, you don't have to worry about the underlying problems. However, this language can not only deal with the upper-layer issues of database interaction, but also realize the underlying problems of interaction with file systems. In my opinion, most people in the PHP community only care about how to get a good result, but not many people care about its true implementation principle. Therefore, this kind of error tends to occur.

Let's look at another news article (): Foreign media today published an analysis article saying that Sun spent $1 billion to buy open-source software company MySQL, mainly to enter the Web2.0 software market. Sun announced on Wednesday that the company has reached a final agreement with MySQL to acquire the open source software vendor for $1 billion. Judging from the transaction value, this is the largest transaction in the open source code field so far. Its scale is even close to the sum of all previous open source code transactions, including Red Hat's $0.326 billion acquisition of JBoss, citrix acquired XenSource for $0.5 billion and Yahoo bought Zimbra for $0.35 billion.

In the article "Sun's president blog: Why do we buy MySQL", Sun proposed that apart from purchasing MySQL, Sun will propose a global support solution for the MySQL market. We will inject funds both in the community and in the market to accelerate the industry's transition from the exclusive technology phase to the open network platform phase. The CTOs of new startups and network companies do not agree to use charged non-open-source products. They also need to obtain the source code to optimize and quickly solve the problem (although they are willing to pay for the support services they think are valuable ). On the other hand, more traditional CIOs do not agree to use products that are not supported by the commercial relationship background-because they are more comfortable using the hands of Sun vendors to manage global businesses and key infrastructure.

Take a closer look.In the old saying, you may think PHP is free, and all the PHP modules mentioned in the manual are free. However, something free, like a viable product, may have many different ideas.

?

<Type = "text/javascript"> <type = "text/javascript" src = "http://pagead2.googlesyndication.com/pagead/show_ads.js">

? There are countless comments in one night. The objection is not unacceptable either. here we will first show a counterargument from an old friend:

? 1 .?? Insufficient object-oriented ??
? If you have used PHP 5, you won't say that. what you think of: access permission (public/private), inheritance, abstract classes, interfaces, cloning, serialization, automatic garbage collection, static members, powerful exception handling ...??
? It can be said that basically all common object-oriented things are available. do not think that php5 is far away. In fact, many people and many projects are currently using PHP 5, you 'd better try it yourself .??
? For more information, see :??
? Http://www-128.ibm.com/developerworks/cn/opensource/os-phpobj ??
? Http://www-128.ibm.com/developerworks/cn/opensource/os-advphpobj ??
? 2 .?? Add question mark (?) before variable name ?? $ ???
? This is only a small problem. PHP tells everyone that this is a unique feature of PHP. PHP is not Java, not C ++. it is a scripting language that comes out of the open source world, with $, I think it's very kind and great .??
? 3 .?? Not compile and execute ??
? Of course, this is not as good as CGI. if you use C to write CGI, but I think the execution speed of PHP will not be worse than that of JSP, and it will not be slower than ASP. In addition, Zend has related commercial tools for compilation .??
? 4 .?? PHP is too flexible ??
? I think everyone prefers a language that can be controlled freely, so as to reflect the programmer's technology. of course, flexibility also brings many problems, such as being easy to make mistakes and difficult to find, the code for beginners may be poorly written. But this is PHP, which is open-source, free, and efficient in our minds ??
? 5 .?? No MVC framework ??
? What if you have used it ?? PhpCake, Zend ?? Frame, I don't think you will say that there is no framework, but it's just a matter of maturity. actually, Cake and Zend ?? Frame is very good. of course, some other images ?? Prado, phpMVC and other frameworks are also worth mentioning ??
? Reference: http://framework.zend.com/?http://cakephp.org /??
? 6 .?? No good IDE ??
? PHP features simplicity and ease of development. you can use notepad, vi, Editplus, UE, Nu, Zend, and other tools, in fact, do not compare it with VS2003, because they are not a single thing. VS is a unified development platform. PHP is just a scripting language and Zend is enough. at least I think so .??
? 7 .?? Extensions cannot be easily written ??
? Haha, I think ASP's com is not so easy to write, and the JavaBeans in JSP is not so simple, there is no easy thing, the degree of simplicity or complexity depends on your understanding of a transaction. If you study C well, you will not feel that expansion is not easy to write. Of course, writing PHP extensions in C is a little complicated, but because of the complexity, you can earn a high salary by writing extensions, huh .??
? For more information, see [extend PHP] in Chapter 14th of PHP programming.
? 8 .?? Is debugging inconvenient ??
? I don't know how debugging is convenient. if you have used ruby or perl to write cgi, you will know what debugging is inconvenient. If you like to write C and use command line tools such as GDB, you will know what is inconvenient. Of course, the debugging workload will be much less if you use a good IDE .?

Related Article

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.