[英]Symfony deploy PHP fatal error: Class not found in AppKernel.php
因此,我一直在為我的單身漢項目構建帶有Symfony3框架的應用程序,並且該程序在localhost上可以完美運行。 無論在開發環境還是產品環境中。
然而。 當我試圖將其部署到Heroku應用時,我得到以下日志。
Generating optimized autoload files
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Creating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
PHP Fatal error: Uncaught Error: Class 'Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle' not found in /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/app/AppKernel.php:15
Stack trace:
#0 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(396): AppKernel->registerBundles()
#1 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(114): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot()
#3 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(118): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvI in /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/app/AppKernel.php on line 15
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Fatal error: Uncaught Error: Class 'Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle' not found in /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/app/AppKernel.php:15
Stack trace:
#0 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(396): AppKernel->registerBundles()
#1 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(114): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot()
#3 /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(118): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvI in /tmp/build_68991520ff4642cdf86248159a2f0f54/Carante-getmoving-585074f/app/AppKernel.php on line 15
.
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...
! Push rejected, failed to compile PHP app.
! Push failed
或者至少這是開始出錯的地方。
我的AppKernel.php文件如下所示。
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new \Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
new AppBundle\AppBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
}
return $bundles;
}
如果我注釋掉AppKernel中的Swiftmailer類,則另一個類將引起完全相同的問題。
我希望這里有人可以幫助我,或者至少可以多了解一些錯誤。
實話實說,部署應用程序和處理服務器端內容不是我最強的站點,因此即時通訊非常深入。
謝謝... :)
我開始像Gopal一樣認為這是文件權限問題。 這是有關需要設置的文件權限的文檔:
https://symfony.com/doc/current/setup/file_permissions.html
Heroku有所不同,所以我對此沒有任何指導,因為我之前從未嘗試過。
@AlvinBunk我已經重新確保了各個文件夾中的權限,並建立了更加穩定的Internet連接,並且以前的作曲家更新錯誤也已消失。
但是..現在,當我嘗試部署該應用程序時,出現與我相同的錯誤。
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SwiftmailerBundle" from namespace "Symfony\Bundle\SwiftmailerBundle".
Did you forget a "use" statement for another namespace? in /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/app/AppKernel.php:16
Stack trace:
#0 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(396): AppKernel->registerBund
les()
#1 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(114): Symfony\Component\HttpK
ernel\Kernel->initializeBundles()
#2 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\C
omponent\HttpKernel\Kernel->boot()
#3 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getm in /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/app/AppKernel.php on l
ine 16
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SwiftmailerBundle" from namespace "Symfony\Bundle\SwiftmailerBundle".
Did you forget a "use" statement for another namespace? in /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/app/AppKernel.php:16
Stack trace:
#0 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(396): AppKernel->registerBund
les()
#1 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(114): Symfony\Component\HttpK
ernel\Kernel->initializeBundles()
#2 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\C
omponent\HttpKernel\Kernel->boot()
#3 /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getm in /Users/carante/KEA/WebDeveloping/3. Semester/Bachelor/Application/getmoving-fiji/app/AppKernel.php on l
ine 16
.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.