How does http-PHP implement servitization?

Source: Internet
Author: User
Can APIs be provided only through http? Can APIs be provided only through http?

Reply content:

Can APIs be provided only through http?

PHP does not have to be called as http. The interfaces of PHP and other applications are called SAPI. Different sapis decide how to call PHP. For example, Apache mod_php is an SAPI implementation for interaction between Apache and PHP. Similarly, the SAPI Implementation of CGI and FastCGI (such as fpm) is also used to call the PHP interpreter through HTTP.
In addition, there are many sapis, such as CLI sapis that support running PHP scripts through command lines. The pcntl_fork function of php can be used in a similar way as that of C (two forks) create a deamon process so that the PHP script can be used as a service.
Php supports socket for service interaction with other processes.
I wrote a small Demo to show you how to use PHP to write a Server. You can take a look:

 

PHP can do service, there is a PHP extension is used to develop high performance and high concurrency of TCP/UDP Server. Here: http://www4swoole.sinaapp.com/

The answer upstairs is awesome!

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.