Symfony和PHP 7.2.5出错

时间:2018-05-25 21:01:57

标签: php symfony symfony4 php-7.2

我试图使用symfony但没有成功。它在本地工作,但我在生产中遇到错误。 有人可以帮忙吗?谢谢你:))

错误:

PHP Fatal error:  Uncaught TypeError: Return value of Symfony\\Component\\Dotenv\\Dotenv::populate() must be an instance of Symfony\\Component\\Dotenv\\void, none returned in /home/admin/web/clair-net-precis.tk/public_html/vendor/symfony/dotenv/Dotenv.php:95\nStack trace:\n#0 /home/admin/web/clair-net-precis.tk/public_html/vendor/symfony/dotenv/Dotenv.php(57): Symfony\\Component\\Dotenv\\Dotenv->populate(Array)\n#1 /home/admin/web/clair-net-precis.tk/public_html/public/index.php(15): Symfony\\Component\\Dotenv\\Dotenv->load('/home/admin/web...')\n#2 {main}\n  thrown in /home/admin/web/clair-net-precis.tk/public_html/vendor/symfony/dotenv/Dotenv.php on line 95

php -v服务器:

PHP 7.2.5-1+0~20180505045740.21+stretch~1.gbpca2fa6 (cli) (built: May  5 2018 04:57:44) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.5-1+0~20180505045740.21+stretch~1.gbpca2fa6, Copyright (c) 1999-2018, by Zend Technologies

php -v dev:

PHP 7.2.5-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: May  5 2018 04:59:13) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.5-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

2 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,直到行号(95),

PHP Fatal error:  Uncaught TypeError: Return value of Symfony\\Component\\Dotenv\\Dotenv::populate() must be an instance of Symfony\\Component\\Dotenv\\void ...

根据@Glen Pinheiro,我禁用了php7.0模块(确保更新了其他软件包之后),然后启用了php7.2模块。快速重启Apache之后,一切井井有条。

换句话说:

sudo apt install apache2 libapache2-mod-php7.2
sudo a2dismod php7.0
sudo a2enmod php7.2
sudo service apache2 restart

答案 1 :(得分:0)

执行以下操作来解决上述问题,

$("input[type='number'][name='jacket_value[]']").on('keyup', function(e){
 console.log(this.value);
});