Describes the advantages of developing website programs in PHP

Source: Internet
Author: User
PHP is an excellent tool, which can be simple or complex. Different projects should use different PHP. In the previous article, we listed the defects of Php. of course, PHP also has a good side.

PHP is an excellent tool, which can be simple or complex. Different projects should use different PHP.

Small Project-simple and direct PHP

For a website with a function page under 20, we can use a simple framework structure. In terms of this scale, I suggest using a more direct process-oriented coding method. The reason is very simple. there is no need to add N to the class file, and the result is a new in the controller. Of course, except for projects with frequent demand changes.

At this level, the advantages of php are obvious: rapid development, clear at a glance. The disadvantages are also well hidden.

Medium-sized Projects-beautiful OO PHP

For a medium-sized project, we recommend that you use a well-designed framework that is based on the MVC model and encapsulates many underlying operations. of course, there must be a good, preferably transparent cache mechanism. in this way, the OO mechanism we add to adapt to changes can run faster and better.

At this level. The disadvantages of php are highlighted, such as incomplete OO support (this PHP5 has been greatly improved), and only single-thread mode is supported. In addition, some peripheral tools are beginning to lack support, such as PHP's lack of good refactoring tools and lack of good integration into the unit test tools in IDE. The advantage is of course the original rapid development and extensive open source resources available.

Large projects-expanded and optimized PHP

A large project here refers to a distributed project, that is, your program needs to be deployed on N servers. At this level, PHP does not have much support than j2ee. I have discussed in detail with shadow 735 some problems that PHP needs to solve in large systems. of course, these problems are not only the problems of PHP, it also includes issues related to peripheral development:

1. PHP page code sharing. after the PHP source code is loaded into the memory once, it will be retained in it-this can be done with the APC and Zend Optimizer.

2. data objects are shared between PHP pages.. php and B. php can share a data object, such as an array, which can be serialized now, but there will be file io, which can be processed using shared memory or memcached.

3. PHP database connection pool, because in the case of multiple front-ends, PHP cannot control the connection to the database, so it is necessary to create a connection pool before the database, similar to sqlrelay. In addition, the data cache is also very important. there is a tip for high-pressure development, that is, the database can not be moved without moving it.

4. PHP front-end cache system. A transparent and controllable cache mechanism ensures that the website page queries the database at least times. This has many implementations, but it is not particularly good.

5. after a PHP application successfully solves these problems, there is no problem in coping with a slight amount of pressure.

At this level, it is important to integrate PHP java C ++ python into an efficient system. We can use memcached for distributed memory management, Lucene for full-text retrieval, ejb containers for some business logic components, and PHP for front-end and system glue, quickly and flexibly bond these together.

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.