webman开发的系统可以正常运行,打包后运行报"签名参数错误"

dpdzq

问题描述

直接源码运行,一切正常。今天试着将程序打包,一运行报错,可能是什么原因呢?

报错信息

Wengg\WebmanApiSign\ApiSignException: 签名参数错误 in phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/wen-gg/webman-api-sign/src/ApiSignService.php:100 Stack trace: #0 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/wen-gg/webman-api-sign/src/ApiSignMiddleware.php(26): Wengg\WebmanApiSign\ApiSignService->check(Array) #1 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/workerman/webman-framework/src/App.php(341): Wengg\WebmanApiSign\ApiSignMiddleware->process(Object(support\Request), Object(Closure)) #2 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/workerman/webman-framework/src/App.php(168): Webman\App::Webman\{closure}(Object(support\Request)) #3 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/workerman/workerman/Connection/TcpConnection.php(646): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(support\Request)) #4 [internal function]: Workerman\Connection\TcpConnection->baseRead(Resource id #547, 2, Resource id #547) #5 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/workerman/workerman/Events/Event.php(193): EventBase->loop() #6 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/workerman/workerman/Worker.php(1635): Workerman\Events\Event->loop() #7 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/workerman/workerman/Worker.php(1426): Workerman\Worker::forkOneWorkerForLinux(Object(Workerman\Worker)) #8 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/workerman/workerman/Worker.php(1400): Workerman\Worker::forkWorkersForLinux() #9 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/workerman/workerman/Worker.php(560): Workerman\Worker::forkWorkers() #10 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/workerman/webman-framework/src/support/App.php(131): Workerman\Worker::runAll() #11 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/webman/console/src/Commands/StartCommand.php(29): support\App::run() #12 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/symfony/console/Command/Command.php(298): Webman\Console\Commands\StartCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #13 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #14 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Webman\Console\Commands\StartCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #15 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #16 phar:///var/www/html/webman.ikidcenter.com/webman.bin/webman(53): Symfony\Component\Console\Application->run() #17 /var/www/html/webman.ikidcenter.com/webman.bin(5): require('phar:///var/www...') #18 {main}
223 2 0
2个回答

dpdzq

我可能知道是什么原因了,可能是 webman-api-sign 这个包的事,我删除这个包试试

  • 暂无评论
dpdzq

上面的问题没有了,首页可以出来了,但是出现新的报错。如下

think\db\exception\PDOException: SQLSTATE[HY000] [2002] No such file or directory in phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/topthink/think-orm/src/db/PDOConnection.php:797 Stack trace: #0 phar:///var/www/html/webman.ikidcenter.com/webman.bin/vendor/topthink/think-orm/src/db/connector/Mysql.php(66): think\db\PDOConnection->getPDOStatement('SHOW FULL COLUM...')

打包的时候不应该都打进去么?我看配置文件有没有剔除这个包,打包的配置文件如下:

return [
'enable' => true,

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

'phar_filename' => 'webman.phar',

'bin_filename' => 'webman.bin',

'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'   => '#^(?!.*(composer.json|/.github/|/.idea/|/.git/|/.setting/|/runtime/|/vendor-bin/|/build/|/vendor/webman/admin/))(.*)$#',

'exclude_files'     => [
    '.env', 'LICENSE', 'composer.json', 'composer.lock', 'start.php', 'webman.phar', 'webman.bin'
],

'custom_ini' => '

memory_limit = 256M
',
];

  • latin 2023-12-08

    SQLSTATE[HY000] [2002] No such file or directory 是数据库host配置有问题,localhost改成127.0.0.1或者实际内网ip

  • dpdzq 2023-12-08

    我现在用的是localhost,直接通过 php start.php start 运行没有问题,就是打包后不行

  • latin 2023-12-09

    不同的php环境localhost代表的socket路径可能不同,改成 127.0.0.1 就解决了

  • dpdzq 2023-12-11

    我试一下,谢谢

🔝