環境:lnmp php
PHP 7.2.12-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Nov 12 2018 09:55:44) ( NTS )ubuntu
如下模塊已開啓php7
執行如下rabbitMQ會報錯app
<?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace app\commands; use yii\console\Controller; use yii\console\ExitCode; use PhpAmqpLib\Connection\AMQPStreamConnection; use PhpAmqpLib\Message\AMQPMessage; /** * This command echoes the first argument that you have entered. * * This command is provided as an example for you to learn how to create console commands. * * @author Qiang Xue <qiang.xue@gmail.com> * @since 2.0 */ class SendController extends Controller { public function actionIndex() { $connection = new AMQPStreamConnection('localhost', 5672, 'admin', 'admin'); $channel = $connection->channel(); $channel->queue_declare('hello', false, false, false, false); $msg = new AMQPMessage('Hello World!!!!!!'); $channel->basic_publish($msg, '', 'hello'); echo " [x] Sent 'Hello World!'\n"; $channel->close(); $connection->close(); } }
這是因爲bcmath的版本對不上的緣由
yii
執行如下更新:
ide
sudo apt-get install php7.2-bcmath
ui
再次執行
spa