Symfony 3 PHP 警告:模块 'intl' 已在第 0 行未知中加载

Symfony 3 PHP Warning: Module 'intl' already loaded in Unknown on line 0

我最近安装了 symfony 3,虽然它似乎工作正常,但我注意到我的错误日志不断填满以下消息。

[10-Jan-2016 01:03:11 America/Chicago] PHP Warning:  Module 'intl' already loaded in Unknown on line 0

在调查之后,我在我的 composer.json 文件中设置了这些,看看是否有帮助。

"symfony/intl": "^3.0.1",
"symfony/polyfill-intl-icu": "^1.0"

但在对页面进行任何操作(如刷新页面或尝试输入登录名等)后我仍然看到错误...

完整的 composer.json 出于安全原因,我的域名已替换为 example.com。

{
    "name": "root/example.com",
    "license": "proprietary",
    "type": "project",
    "autoload": {
        "psr-4": {
            "": "src/"
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "require": {
        "php": ">=5.5.9",
        "symfony/symfony": "3.0.*",
        "doctrine/orm": "^2.5",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/doctrine-cache-bundle": "^1.2",
        "symfony/swiftmailer-bundle": "^2.3",
        "symfony/monolog-bundle": "^2.8",
        "sensio/distribution-bundle": "^5.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "^2.0",
        "symfony/intl": "^3.0.1",
        "symfony/polyfill-intl-icu": "^1.0"
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^2.7"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\ParameterHandler\ScriptHandler::buildParameters",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-update-cmd": [
            "Incenteev\ParameterHandler\ScriptHandler::buildParameters",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget"
        ]
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        }
    }
}

此外,我尝试按照与我的问题类似的建议(Problems installing Symfony 2.4.1 lib-icu 4.4 dependency)进行操作,但是当我尝试设置 "symfony/icu": "1.1.*" 时,作曲家拒绝这样做,因为我正在使用 symfony 3...

我什至不确定我的问题是否和他的一样。

我在 Centos Linux 服务器上使用 WHM/Cpanel 以防有任何 UNIX 命令我需要 运行 解决这个问题。

我相信我也已经通过 WHM 控制面板安装了 intl 扩展,但我也不是 100% 确定我是否正确地安装了它。我附上了它在我的控制面板中的外观图片。

我也尝试按照此处的说明进行操作 (http://symfony.com/doc/current/components/intl.html)

如何消除错误消息?

我相信这与 Symfony 无关。

通常情况是您安装的 PHP 版本使用 --with-intl 选项编译(intl built-in)并且您还安装了 intl 扩展。

尝试禁用/卸载 intl 扩展并测试您是否仍然可以毫无问题地使用 symfony/intl 功能。

v5.0.17 之前的 SensioDistributionBundle 在与 Composer v1.3 (more details) 一起使用时会产生此类错误。

检查您是否会受到影响:

composer --version && composer show | grep distribution-bundle

如果是这样,请将 SensioDistributionBundle 更新到最新版本以解决此问题:

composer update sensio/distribution-bundle