'Compile Error: App\Kernel::registerBundles(): Failed opening required while deploying website
I'm working on NetBeans
in a project built on Symfony4
.
The project runs ok on mode dev aswell as on mode prod, buy when I deploy it son the web:
"Compile Error: App\Kernel::registerBundles(): Failed opening required...".
If I change the server php version to 7, the result in Error500 (to generic to know where the problem is).
On server php
7.1 the error is App\Kernel...
Some info about the project :
"require": {
"php": "^7.1.3",
"ext-iconv": "*",
"friendsofsymfony/user-bundle": "dev-master",
"knplabs/knp-paginator-bundle": "^2.7",
"sensio/framework-extra-bundle": "^5.1",
"sensiolabs/security-checker": "^4.1",
"sonata-project/admin-bundle": "dev-master",
"symfony/apache-pack": "^1.0",
"symfony/asset": "^4.0",
"symfony/console": "^4.0",
"symfony/flex": "^1.0",
"symfony/form": "^4.0",
"symfony/framework-bundle": "^4.0",
"symfony/lts": "^4@dev",
"symfony/maker-bundle": "^1.0",
"symfony/orm-pack": "^1.0",
"symfony/requirements-checker": "^1.0",
"symfony/security-bundle": "^4.0",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/templating": "^4.0",
"symfony/translation": "^4.0",
"symfony/twig-bundle": "^4.0",
"symfony/validator": "^4.0",
"symfony/var-dumper": "^4.0",
"symfony/yaml": "^4.0",
"vich/uploader-bundle": "^1.8"
},
"require-dev": {
"symfony/dotenv": "^4.0",
"symfony/profiler-pack": "^1.0",
"symfony/web-server-bundle": "^4.0"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
"requirements-checker": "script",
"security-checker security:check": "script"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
...}
Any idea how to solve this problem ? Should I rewrite the site ? Thanks for your help!
Solution 1:[1]
Hi @moni i have this error: my error
And my solution later than i search and search for days is this:
https://symfony.com/doc/current/reference/configuration/kernel.html#project-directory
If for some reason the composer.json file is not stored at the root of your project, you can override the getProjectDir() method to return the right project directory:
and you have to override getProjectDir function on your
src/Kernel.php
file like this:
public function getProjectDir()
{
return realpath(__DIR__.'/../');
}
And thats all my symfony now find my bundle.php file and now works like a charm ! hope it works for you !
Solution 2:[2]
I got also the same problem. I think the problem was du the fact that the symfony project on the local machine was not in main partition where u have the admin right. And I noticed that on the server the cache file is not created.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jasson Rojas |
Solution 2 | Marcus Kim |