PHP has no middleware, causing a lot of trouble. For example, database operations must be linked to the database and then performed SQL operations. Web programs directly operate databases, which may cause many potential accidents and management problems, especially for large-scale website applications. The standard mode should be that the web program transmits parameters to a service program, which judges and finally operates the database or other data files, so that explicit permission control is achieved, and centralized management of business types. Last year, along with the launch of ice, PHP finally had a ready-to-use middleware. The development history of PHP should be a milestone.
1. What is middleware?
Middleware is a reusable software. Middleware is built on the operating system, network, and database, and the lower layer of the application software. Its role is to provide an environment for running and developing the application software on its upper layer, it helps users develop and integrate complex application software flexibly and efficiently.
In the history of middleware development, there were three very successful middleware Products. RPC (Remote process call
Remote Process calling) is the first release by Sun. Currently, all Linux, BSD, and other operating systems are supported at the kernel level, supports TCP, UDP, Unix-socket, and other network protocols. The well-known NFS is developed based on rpc. Winrpc is a Microsoft product. It should be said that it is a counterfeit RPC, and network neighbors are developed based on winrpc. Another is the typical commercial software middleware, which provides greater flexibility and ease of use. Unfortunately, almost all of the middleware lacks support for PHP. The so-called support is not supported by Lib in this language, but PHP can be written in C.
Extension completed.
The middleware working mode is basically: the user's clinet logic function is fast ---> middleware clinet Module
---- Network ----->
Middleware server module -----> User server logic functional block. It can be seen that middleware has completed the most complicated part. When using middleware, developers only need to focus on the implementation of business function logic, which greatly shortens the development time.
2. Ice and PHP
Ice (Internet communications Engine
Network Communication engine) is an open-source middleware developed by the original core members of CORBA. It is said that its performance is completely better than that of CORBA. In addition, we first saw middleware that directly supports PHP.
Ice installation, go to the http://www.zeroc.com/download.html to download an ice for PHP installation package, install according to instructions.
Use of ice: Use slice (a simple syntax script of ice) to write a XX. ICE file. You can use slice2cpp or slice2java to generate a CPP or Java ice Framework Program, and then write code in this framework program. The Application of ice in PHP inherits the consistent tradition of PHP-simple. You only need to load XX. Ice in PHP. ini to use it.
The disadvantages of ice in PHP applications are that it is impossible to use PHP to write the server. In fact, this is also a defect of PHP-there is no complete multi-process and multi-thread management mechanism. Therefore, the server can be written in other languages supported by ice, such as Java/C ++/Vb/python.
3. Ice makes breakthroughs in PHP, quickly implementing the communication between web programs like. Net/Java and other service programs, so that PHP can cope with more complex application frameworks. Ice Official Website: http://www.zeroc.com/
For more information, see phper.