我正在尝试将Symfony应用程序部署到Webhosting并出现此错误
Fatal error: Interface 'Symfony\Component\Routing\Matcher\RequestMatcherInterface' not found in /data/web/virtuals/201283/virtual/www/subdom/dev/vendor/symfony/routing/Matcher/UrlMatcher.php on line 29
我的虚拟主机没有SSH访问权限,因此我复制了除var和test以外的所有文件夹。然后将.env和composer.json移至/ subdom / dev(该subdom与常规HTML索引一起使用)
使用php 7.3。Composer.json
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"gedmo/doctrine-extensions": "^2.4",
"knplabs/knp-time-bundle": "^1.9",
"sensio/framework-extra-bundle": "^5.1",
"stof/doctrine-extensions-bundle": "^1.3",
"symfony/apache-pack": "^1.0",
"symfony/asset": "4.3.*",
"symfony/console": "4.3.*",
"symfony/dotenv": "4.3.*",
"symfony/expression-language": "4.3.*",
"symfony/flex": "^1.3.1",
"symfony/form": "4.3.*",
"symfony/framework-bundle": "4.3.*",
"symfony/http-client": "4.3.*",
"symfony/intl": "4.3.*",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "*",
"symfony/process": "4.3.*",
"symfony/security-bundle": "4.3.*",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "4.3.*",
"symfony/twig-bundle": "4.3.*",
"symfony/validator": "4.3.*",
"symfony/web-link": "4.3.*",
"symfony/yaml": "4.3.*",
"vich/uploader-bundle": "^1.10"
},
"require-dev": {
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.0",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/web-server-bundle": "4.3.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.3.*"
}
}
}
编辑:我尝试过echo interface_exists("Symfony\Component\Routing\Matcher\UrlMatcherInterface");
,它返回1。但是错误仍然在这里。
我不知道下一步去哪里。
好,给你,谁读了这个。不要与错误争论。如果错误,则说明找不到它,并进行修复。 Filezilla发生了某些情况,并且某些文件未正确传输(创建时大小为0B)。所以我手动复制了它们。
根据您的composer.json,缺少"symfony/routing": "4.3.*",
,因此Symfony路由组件不可用。但是,我不明白为什么interface_exists在您的情况下返回true ...