Giter Club home page Giter Club logo

php-sockert's Introduction

PHP并发IO编程之路

  • 并发 IO 问题一直是服务器端编程中的技术难题,从最早的同步阻塞直接 Fork 进程,到 Worker 进程池/线程池,到现在的异步IO、协程。PHP 程序员因为有强大的 LAMP 框架,对这类底层方面的知识知之甚少,本文目的就是详细介绍 PHP 进行并发 IO 编程的各种尝试。

1、socket 编程

2、多进程 实现socket编程

3 、 select

4, poll

5、 epoll (使用libevent 扩展,实现 epoll I/O 多路复用)

event 扩展安装

以下测试是在unbantu系统,php7.2 php7.2 安装event扩展

1、拉去docker php7.2镜像 docker pull phpdockerio/php72-fpm (或者直接拉取我的镜像 : ) //挂载目录 docker run --name myphp72-fpm -v /Users/zhuliubao:/www/php-project -d phpdockerio/php72-fpm:latest // 进入容器 docker exec -it myphp72-fpm bash

2、 安装event前,确保已经安装sockets 扩展

通过php -m |grep sockets 查看是否安装

如果没有安装sockets扩展,在安装event时,会报如下错误 onfigure: error: Couldn't find /usr/local/include/php/sockets/php_sockets.h. Please check if sockets extension installed

3、安装event扩展依赖的libevent-dev包,命令行运行
apt-get install libevent-dev -y

4、 安装event扩展 pecl install event

注意提示:Include libevent OpenSSL support [yes] : 时输入no回车, 注意提示:PHP Namespace for all Event classes :时输入yes,其它直接敲回车就行

可能碰到问题:

1、ubuntu~ phpize: command not found 解决办法: sudo apt-get install php-dev or :sudo apt-get install php7.2-dev

  • 说明 可以使用,已经 打包镜像 (docker push zlbonlydocker/php72-fpm:tagname )

php-sockert's People

Contributors

zlbonly avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.