Download the PHP package wuzehv/phpmw without Composer

On this page you can find all versions of the php package wuzehv/phpmw. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpmw

php多进程

使用

  1. 安装

  2. 使用

实现原理

进程间通信采用socket

  1. 启动主进程,作为manager,监听随机端口
  2. 启动master进程,连接manager
  3. 启动多个worker进程,连接manager
  4. 调用run方法后,内部调用业务方实现的master方法,添加任务给manager
  5. manager将任务分发给空闲的worker进程,worker进程调用业务方实现的worker方法
  6. 任务处理完成,所有进程退出

可能遇到的问题

僵尸进程

  1. master添加完任务后就会退出,在程序退出之前会作为僵尸进程存在
  2. worker进程如果出现致命错误,会作为僵尸进程存在,也即不能处理任何请求

最终都会被主进程回收

如何kill所有的进程

直接kill主进程pid即可,因为程序内部做了SIGINT、SIGTERM信号处理,信号处理器会系统调用kill -KILL pid强制杀死所有子进程

理论上不需要执行类似这种命令ps -ef | grep ...... | awk '{print $2}' | xargs kill -9

进程树查看

Too many open files

这个错误是进程文件描述符个数限制,查看设置ulimit -n

异常处理

  1. master方法内的异常会导致master进程退出,已添加的任务会继续执行,直至退出
  2. worker进程内的异常会被捕获,但是不会产生任何错误输出,所以需要业务方务必自行捕获异常

job少,worker进程多

执行过程中,master进程会迅速执行完毕并发送退出信息,socket_select获取到master退出信息,在所有任务分发完成后,manager从select的死循环break,之后会调用quitAll方法,多于的worker进程会结束,执行中的worker会继续执行,直至完成退出

job多,worker进程少

job生成时,master会写入大量job到socket,worker会慢慢进行处理,此时master进程和worker进程会同时存在

在worker进程都在工作的时候,socket_select会暂时不监听master进程套接字,直至有worker进程空闲,从而实现进程的分发


All versions of phpmw with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
ext-pcntl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wuzehv/phpmw contains the following files

Loading the files please wait ....