打包后运行会报错,排查发现是打包没有把插件包含进去

songshu

使用命令php webman phar:pack 打包,生成了 webman.phar。
运行后报错:

但是实际上项目是安装了这个插件的:

看了一下确实没有把这个插件打包进去:

感觉这个打包命令需要微调一下

623 3 0
3个回答

walkor 打赏

先不打包运行看下是否有报错。
发下config/plugin/webman/console/app.php配置

  • songshu 2023-11-29

    不打包是可以正常运行的,配置放下面了

songshu
<?php
return [
    /** 打包命令: php -d phar.readonly=0 ./webman phar:pack */
    /** 然后开启这个enable 放开下面的注释 */
    'enable'            => true,

    'phar_file_output_dir'    => BASE_PATH . DIRECTORY_SEPARATOR . 'build',

    'phar_filename'     => 'webman.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|tests|Tests|vendor-bin|.md))(.*)$#',

    'exclude_files'     => [
        '.env', 'LICENSE', 'composer.json', 'composer.lock','start.php'
    ]
];
  • 暂无评论
songshu

感觉是配置的问题,把配置修改后就正常了

<?php
return [
    /** 打包命令: php -d phar.readonly=0 ./webman phar:pack */
    /** 然后开启这个enable 放开下面的注释 */
    'enable'            => true,

    'phar_file_output_dir'    => BASE_PATH . DIRECTORY_SEPARATOR . 'build',

    'phar_filename'     => 'webman.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|tests|Tests|vendor-bin|.md))(.*)$#',
    'exclude_pattern'   => '#^(?!.*(composer.json|/.github/|/.idea/|/.git/|/.setting/|/runtime/|/vendor-bin/|/build/|vendor/webman/admin))(.*)$#',
    'exclude_files'     => [
        '.env', 'LICENSE', 'composer.json', 'composer.lock','start.php'
    ]
];
  • 暂无评论
年代过于久远,无法发表回答
×
🔝