phar 打包后,终端运行可以,守护启动不行

leesin

webman 打包成 phar 之后,直接启动可以的,只要是守护启动,提示成功,但是查看进程其实没有启动起来都

php8.0 start.phar start -d 提示

查询 提示
php8.0 start.phar status

Workerman[./dm_pay_system.phar] status 
Workerman[./dm_pay_system.phar] not run

查询进程也是找不到

1210 1 1
1个回答

walkor 打赏

从截图看启动命令并不是 php8.0 start.phar start -d

  • leesin 2022-12-13

    重新改了个打包名,其实都是一样的,大佬

  • leesin 2022-12-13

    不想用 nohup 挂起启动,管理不好管理

  • walkor 2022-12-13

    执行 ps auxf 看下进程在不在

  • leesin 2022-12-13

    root@iZbp1f2en293wuktj3vx1cZ:/data/www/dmPaySystem/build# ps auxf |grep 8787
    root 6291 0.0 0.0 14432 1024 pts/2 S+ 10:53 0:00 | | _ grep --color=auto 8787
    root@iZbp1f2en293wuktj3vx1cZ:/data/www/dmPaySystem/build# ps auxf |grep dm_pay_system
    root 6603 0.0 0.0 14432 1008 pts/2 S+ 10:54 0:00 | | _ grep --color=auto dm_pay_system

  • walkor 2022-12-13

    用markdown方式发

  • walkor 2022-12-13

    php start.php start -d 是否有问题?

  • leesin 2022-12-13

    有问题

  • leesin 2022-12-13
    php8.0 dm_pay_system.phar start -d 
    Workerman[dm_pay_system.phar] start in DAEMON mode
    ---------------------------------------------------- WORKERMAN ----------------------------------------------------
    Workerman version:4.1.4          PHP version:8.0.22           Event-Loop:\Workerman\Events\Select
    ----------------------------------------------------- WORKERS -----------------------------------------------------
    proto   user            worker                                listen                 processes    status           
    tcp     root            dm_pay_system                         http://0.0.0.0:8787    16            [OK]            
    tcp     root            monitor                               none                   1             [OK]            
    tcp     root            plugin.webman.redis-queue.consumer    none                   6             [OK]            
    -------------------------------------------------------------------------------------------------------------------
    Input "php dm_pay_system.phar stop" to stop. Start success.
  • leesin 2022-12-13

    这里是打包配置:

    <?php
    return [
        'enable'            => true,
    
        'phar_file_output_dir'    => BASE_PATH . DIRECTORY_SEPARATOR . 'build',
    
        'phar_filename'     => 'dm_pay_system.phar',
    
        'signature_algorithm'=> Phar::SHA256, //set the signature algorithm for a phar and apply it. The signature algorithm must be one of Phar::MD5, Phar::SHA1, Phar::SHA256, Phar::SHA512, or Phar::OPENSSL.
    
        'private_key_file'  => '', // The file path for certificate or OpenSSL private key file.
    
        'exclude_pattern'   => '#^(?!.*(config/plugin/webman/console/app.php|webman/console/src/Commands/(PharPackCommand.php|ReloadCommand.php)|LICENSE|composer.json|.github|.idea|doc|docs|.git|.setting|runtime|test|test_old|.env.example|composer.lock|tests|Tests|vendor-bin|.md))(.*)$#',
    
        'exclude_files'     => [
            '.env', 'LICENSE', 'composer.json', 'composer.lock','start.php', '.env.example', '.gitignore', 'README.md', 'windows.bat', 'windows.php'
        ]
    ];
  • walkor 2022-12-13

    执行 strace -f php dm_pay_system.phar start -d 看下进程为什么退出

  • leesin 2022-12-13

    很奇怪哦,是不是还有什么 php 函数禁用了,我在本地的 linux 子系统上这么操作是可行的

  • leesin 2022-12-13

    但是没提示报错

  • leesin 2022-12-13
    [pid  2656] write(1, "\nFatal error: Uncaught Error: Ca"..., 1821 <unfinished ...>
    [pid  2687] <... lseek resumed> )       = 0
    [pid  2656] <... write resumed> )       = 1821
    [pid  2687] lseek(3, 0, SEEK_CUR)       = 0
    [pid  2687] close(3)                    = 0
    [pid  2656] write(1, "\nFatal error: Uncaught TypeError"..., 177 <unfinished ...>
    [pid  2687] close(1)                    = 0
    [pid  2656] <... write resumed> )       = 177
    [pid  2687] close(2)                    = 0
    [pid  2656] close(2)                    = 0
    [pid  2656] close(1 <unfinished ...>
    [pid  2687] openat(AT_FDCWD, "/data/release/dmPaySystem/63_1681_20221212_184623/build/runtime/logs/stdout.log", O_WRONLY|O_CREAT|O_APPEND, 0666 <unfinished ...>
    [pid  2656] <... close resumed> )       = 0
    [pid  2687] <... openat resumed> )      = 1
    [pid  2687] fstat(1,  <unfinished ...>
    [pid  2656] close(0 <unfinished ...>
    [pid  2687] <... fstat resumed> {st_mode=S_IFREG|0666, st_size=474399, ...}) = 0
    [pid  2676] munmap(0x7fb92be00000, 2097152 <unfinished ...>
    [pid  2687] lseek(1, 0, SEEK_CUR <unfinished ...>
    [pid  2656] <... close resumed> )       = 0
    [pid  2676] <... munmap resumed> )      = 0
    [pid  2685] munmap(0x7fb92be00000, 2097152) = 0
    [pid  2685] munmap(0x7fb92ba00000, 2097152) = 0
    [pid  2687] <... lseek resumed> )       = 0
    [pid  2676] munmap(0x7fb92ba00000, 2097152 <unfinished ...>
    [pid  2656] munmap(0x7fb92be00000, 2097152 <unfinished ...>
    [pid  2685] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7fb92ba999f0} ---
    [pid  2656] <... munmap resumed> )      = 0
    [pid  2687] lseek(1, 0, SEEK_CUR <unfinished ...>
    [pid  2676] <... munmap resumed> )      = 0
    [pid  2687] <... lseek resumed> )       = 0
    [pid  2656] munmap(0x7fb92ba00000, 2097152) = 0
    [pid  2686] munmap(0x7fb92be00000, 2097152 <unfinished ...>
    [pid  2656] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7fb92ba999f0} ---
    [pid  2676] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7fb92ba999f0} ---
    [pid  2686] <... munmap resumed> )      = 0
    [pid  2686] munmap(0x7fb92ba00000, 2097152) = 0
    [pid  2686] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7fb92ba999f0} ---
    [pid  2685] +++ killed by SIGSEGV +++
    [pid  2656] +++ killed by SIGSEGV +++
    [pid  2687] openat(AT_FDCWD, "/data/release/dmPaySystem/63_1681_20221212_184623/build/runtime/logs/stdout.log", O_WRONLY|O_CREAT|O_APPEND, 0666 <unfinished ...>
    [pid  2686] +++ killed by SIGSEGV +++
    [pid  2676] +++ killed by SIGSEGV +++
    <... openat resumed> )                  = 2
    fstat(2, {st_mode=S_IFREG|0666, st_size=474399, ...}) = 0
    lseek(2, 0, SEEK_CUR)                   = 0
    lseek(2, 0, SEEK_CUR)                   = 0
    write(1, "\nFatal error: Uncaught Error: Ca"..., 2328) = 2328
    write(1, "\nFatal error: Uncaught TypeError"..., 177) = 177
    close(2)                                = 0
    close(1)                                = 0
    close(0)                                = 0
    munmap(0x7fb92be00000, 2097152)         = 0
    munmap(0x7fb92ba00000, 2097152)         = 0
    --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7fb92ba999f0} ---
    +++ killed by SIGSEGV +++
  • leesin 2022-12-13

    这是哪个函数被禁用了吧

  • walkor 2022-12-13

    strace -s 4000 -f php dm_pay_system.phar start -d 用这个命令看下

  • leesin 2022-12-13

    posix_isatty 函数禁用了,其他函数每次启动都提示这个没提示

  • leesin 2022-12-13
    [pid  4912] write(1, "\nFatal error: Uncaught Error: Call to undefined function posix_isatty() 

    这个函数能不能想其他函数一样进行提示呢

  • leesin 2022-12-13

    跟着大佬学习了一个命令,仔细查了下,还挺有用,大佬牛批

年代过于久远,无法发表回答
×
🔝