Php 拉威尔投掷';康塞顿拒绝';偶尔出错

Php 拉威尔投掷';康塞顿拒绝';偶尔出错,php,laravel,Php,Laravel,我在一个laravel项目中有一张付款单,上面有可用的数据库凭证 Laravel版本:5.1.36, PHP版本:5.5.9 但是在提交时,它偶尔会返回以下错误,并且偶尔会工作。我不知道为什么或者什么时候它会返回这个。提交时所有代码都会运行,但页面会因此错误而重新加载 [2020-02-06 12:24:04] stage.ERROR: exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Connection refused

我在一个laravel项目中有一张付款单,上面有可用的数据库凭证

Laravel版本:5.1.36, PHP版本:5.5.9

但是在提交时,它偶尔会返回以下错误,并且偶尔会工作。我不知道为什么或者什么时候它会返回这个。提交时所有代码都会运行,但页面会因此错误而重新加载

[2020-02-06 12:24:04] stage.ERROR: exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Connection refused' in /var/www/html/testhyl.ajency.in/public_html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:55
Stack trace:
#0 /var/www/html/testhyl.ajency.in/public_html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(55): PDO->__construct('mysql:host=loca...', 'root', 'password', Array)
#1 /var/www/html/testhyl.ajency.in/public_html/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(22): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=loca...', Array, Array)
#2 /var/www/html/testhyl.ajency.in/public_html/bootstrap/cache/compiled.php(11445): Illuminate\Database\Connectors\MySqlConnector->connect(Array)
#3 /var/www/html/testhyl.ajency.in/public_html/bootstrap/cache/compiled.php(11441): Illuminate\Database\Connectors\ConnectionFactory->createSingleConnection(Array)
#4 /var/www/html/testhyl.ajency.in/public_html/bootstrap/cache/compiled.php(11356): Illuminate\Database\Connectors\ConnectionFactory->make(Array, 'mysql')
#5 /var/www/html/testhyl.ajency.in/public_html/bootstrap/cache/compiled.php(11311): Illuminate\Database\DatabaseManager->makeConnection('mysql')
#6 /var/www/html/testhyl.ajency.in/public_html/vendor/laravel/framework/src/Illuminate/Queue/Connectors/DatabaseConnector.php(38): Illuminate\Database\DatabaseManager->connection(NULL)
#7 /var/www/html/testhyl.ajency.in/public_html/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php(133): Illuminate\Queue\Connectors\DatabaseConnector->connect(Array)
#8 /var/www/html/testhyl.ajency.in/public_html/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php(113): Illuminate\Queue\QueueManager->resolve('database')
#9 /var/www/html/testhyl.ajency.in/public_html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(149): Illuminate\Queue\QueueManager->connection(NULL)
#10 /var/www/html/testhyl.ajency.in/public_html/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(109): Illuminate\Queue\Worker->pop(NULL, 'index_user,upda...', 0, '3', '3')
#11 /var/www/html/testhyl.ajency.in/public_html/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(71): Illuminate\Queue\Console\WorkCommand->runWorker(NULL, 'index_user,upda...', 0, 128, false)
#12 [internal function]: Illuminate\Queue\Console\WorkCommand->fire()
#13 /var/www/html/testhyl.ajency.in/public_html/bootstrap/cache/compiled.php(1187): call_user_func_array(Array, Array)
#14 /var/www/html/testhyl.ajency.in/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(150): Illuminate\Container\Container->call(Array)
#15 /var/www/html/testhyl.ajency.in/public_html/vendor/symfony/console/Command/Command.php(256): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/html/testhyl.ajency.in/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/testhyl.ajency.in/public_html/vendor/symfony/console/Application.php(841): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/html/testhyl.ajency.in/public_html/vendor/symfony/console/Application.php(189): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/testhyl.ajency.in/public_html/vendor/symfony/console/Application.php(120): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/html/testhyl.ajency.in/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/testhyl.ajency.in/public_html/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
我在mysql错误日志中找到了这个

2020-02-06T12:24:12.836270Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-02-06T12:24:12.839288Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.28) starting as process 3013 ...
2020-02-06T12:24:12.844361Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-02-06T12:24:12.844425Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-02-06T12:24:12.844433Z 0 [Note] InnoDB: Uses event mutexes
2020-02-06T12:24:12.844440Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-02-06T12:24:12.844445Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-02-06T12:24:12.844450Z 0 [Note] InnoDB: Using Linux native AIO
2020-02-06T12:24:12.844910Z 0 [Note] InnoDB: Number of pools: 1
2020-02-06T12:24:12.845100Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-02-06T12:24:12.847590Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-02-06T12:24:12.847671Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2020-02-06T12:24:12.847689Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2020-02-06T12:24:12.847698Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-02-06T12:24:12.847706Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-02-06T12:24:12.847720Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-02-06T12:24:12.847728Z 0 [ERROR] Failed to initialize builtin plugins.
2020-02-06T12:24:12.847731Z 0 [ERROR] Aborting

这可能与连接池有关。你一次有很多用户吗?没有。这是一个临时站点。我是唯一一个测试它的人你的环境有足够的内存吗?有时服务器会优先使用Apache/PHP而不是Mysql。试试看你的mysql日志。我已经添加了mysql日志。你能检查一下吗?我就是这么想的:
无法为缓冲池分配内存。你的mysql需要更多的RAM。