承接 takuya/php-daemonize-pcntl 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

takuya/php-daemonize-pcntl

最新稳定版本:0.1.3.1

Composer 安装命令:

composer require takuya/php-daemonize-pcntl

包简介

README 文档

README

daemonize function by pcntl_fork.

php daemon Daemonize all

Daemonize any process , written by php ( pcntl )

installing

from Packagist

composer require takuya/php-daemonize-pcntl

from GitHub

name='php-daemonize-pcntl'
composer config repositories.$name \
vcs https://github.com/takuya/$name  
composer require takuya/$name:master
composer install

Examples

function / Daemonize ( detach tty and parent PID=1)

<?php

require_once 'vendor/autoload.php';
use Takuya\PhpDaemonize\PhpDaemonize;

/**
* Daemonize function
 */
$m = new PhpDaemonize();
$m->start(function () { sleep(1000); });
$m->stop();

Run command as daemon

<?php

require_once 'vendor/autoload.php';
use Takuya\PhpDaemonize\PhpDaemonize;

/**
* Daemonize function
 */
$m = new PhpDaemonize();
$m->start(function () { pcntl_exec('/usr/bin/sleep',[10]) });

service (init.d)

this package help to make init.d service

run web server

my-server.sh

#!/usr/bin/env php
require_once 'vendor/autoload.php';
use Takuya\PhpDaemonize\PhpDaemonize;


$name = 'my-server';
// start stop
PhpDaemonize::run_func(function(){
  pcntl_exec('/usr/bin/php',['artisan','serve'])
},$name);

start and stop

./my-server.sh start
./my-server.sh stop

统计信息

  • 总下载量: 983
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2025-02-14