Home  >  Article  >  Backend Development  >  Can php and java be shared?

Can php and java be shared?

(*-*)浩
(*-*)浩Original
2019-10-21 09:15:425635browse

Verify that two languages ​​(JAVA/PHP) are kings in their respective fields. Different languages ​​and different mechanisms are combined together. PHP is responsible for the WEB layer, and Java is responsible for the business and data logic layer. It is really a golden combination (Java PHP integration =The new darling of hybrids), giving full play to their respective advantages and suitable for developing B/S enterprise programs.

Can php and java be shared?

Message Queue (Recommended learning: PHP video tutorial)

Can php and java be shared?

As can be seen from the above figure, PHP assumes the responsibilities of the HTTP layer, while Java assumes the responsibilities of the business layer. They communicate with each other through System V Message Queue (message queue, a type of inter-process communication IPC). Java Requires JNI support.

Using message queue has the following benefits:

1. Keeps php and java independent

2. Has extremely high transmission speed, greater than socket

3. Compared with the socket method, the Java server only provides services to the local machine (no external listening port), which is relatively safe and easy to manage.

Java and PHP combination selection

The currently known integration technologies of PHP and Java on the Web can be divided into SOAP (Simple Object Access Protocol), Quercus , PHP/Java Bridge. These technologies allow PHP and Java to use each other's libraries when developing Web applications.

SOAP

SOAP is a protocol developed by IBM, Microsoft and other companies and recommended by W3C to implement distributed object technology. SOAP provides a set of mechanisms that use XML to package program calls, parameter transfers, and information return. With the plain text characteristics of XML, it can traverse enterprise firewalls through communication channels such as HTTP, HTTPS, and SMTP. Compared with CORBA, Java RMI and DCOM, which are distributed object technology protocols that transmit data in proprietary binary formats, SOAP has the characteristics of being independent of programming language, platform and hardware.

Quercus

Quercus is an open source PHP 5 engine that already has a complete implementation in pure Java. Quercus runs on Resin application servers and takes advantage of Resin features such as load balancing and proxy caching.

PHP/Java Bridge

Open source products include: Php-java-bridge and LAJP

The above is the detailed content of Can php and java be shared?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn