直接源码运行,一切正常。今天试着将程序打包,一运行报错,可能是什么原因呢?
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}
我可能知道是什么原因了,可能是 webman-api-sign 这个包的事,我删除这个包试试
上面的问题没有了,首页可以出来了,但是出现新的报错。如下
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,
memory_limit = 256M
',
];
SQLSTATE[HY000] [2002] No such file or directory 是数据库host配置有问题,localhost改成127.0.0.1或者实际内网ip
我现在用的是localhost,直接通过 php start.php start 运行没有问题,就是打包后不行
不同的php环境localhost代表的socket路径可能不同,改成 127.0.0.1 就解决了
我试一下,谢谢