I have an exiting project in Symfony running on windows. Now I moved it to my laptop which runs Ubuntu 16.04. But when I try to do app/console it says that class was not found in AppKernel.
Here is the actual error message.
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "PimSecurityBundle" from namespace "Pim\SecurityBundle".
Did you forget a "use" statement for another namespace? in /var/www/html/pim/app/AppKernel.php:34
Stack trace:
0 /var/www/html/pim/app/bootstrap.php.cache(2675): AppKernel->registerBundles()
1 /var/www/html/pim/app/bootstrap.php.cache(2497): Symfony\Component\HttpKernel\Kernel->initializeBundles()
2 /var/www/html/pim/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(70): Symfony\Component\HttpKernel\Kernel->boot()
3 /var/www/html/pim/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(123): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
4 /var/www/html/pim/app/console(27): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
5 {m in /var/www/html/pim/app/AppKernel.php on line 34
I already run composer update several times, remove my vendor and update but nothing works.
Related
I have a newly cloned phalcon repository:
software: MacOS
Phalcon: 5.0.0RC4
PHP: 8.1
Zephir: 0.16.0
brew: phalcon#4.1.0
Location: ~/Documents/cphalcon
I am trying to set up my new repository by following the tutorial here.
However when I go to my page at localhost:8000, this error pops up:
Fatal error: Uncaught Error: Class "Phalcon\Loader\Loader" not found in /Users/apple/Documents/cphalcon/public/index.php:16 Stack trace: #0 /Users/apple/Documents/cphalcon/.htrouter.php(15): require_once() #1 {main} thrown in /Users/apple/Documents/cphalcon/public/index.php on line 16
I found some similar thread and they said to check my phpinfo to see if phalcon is there, and it was.
I checked for more materials but couldn't find any other clues.
I also tried changing the call to:
use Phalcon\Loader;
But it was the same
Fatal error: Uncaught Error: Class "Phalcon\Loader" not found in /Users/apple/Documents/cphalcon/public/index.php:16 Stack trace: #0 /Users/apple/Documents/cphalcon/.htrouter.php(15): require_once() #1 {main} thrown in /Users/apple/Documents/cphalcon/public/index.php on line 16
Any clues?
I believe that in version 5 the proper syntax now is Phalcon\Autoload\Loader().
Since Phalcon 5 is still in Release Candidate mode (hence the "RC4" on the version), the docs are still lagging a bit behind.
I've converted a couple of Phalcon 3 and 4 sites, and I found the Phalcon 5.0.0RC4 ChangeLog to be helpful when moving from Phalcon 4 to 5. The move from 3 to 5 is far more involved and requires finding the Phalcon 4 update doc on the Phalcon web site.
I hope this helps.
I just took a project from a couple of months ago which was made in Laravel. This project also utilizes Laravel Voyager - the admin panel package.
After browsing to http://example.com/admin, I got this weird error which came out of nowhere and I'm also unsure how to debug it. It looks like this:
Fatal error: Cannot declare class Symfony\Component\HttpFoundation\AcceptHeader, because the name is already in use in /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php on line 22
Fatal error: Uncaught Error: Class 'Symfony\Component\HttpFoundation\AcceptHeaderItem' not found in /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php:61 Stack trace: #0 [internal function]: Symfony\Component\HttpFoundation\AcceptHeader::Symfony\Component\HttpFoundation\{closure}(Array) #1 /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php(57): array_map(Object(Closure), Array) #2 /c/Users/User/Code/example-website/vendor/symfony/http-foundation/Request.php(1664): Symfony\Component\HttpFoundation\AcceptHeader::fromString('text/html,appli...') #3 /c/Users/User/Code/example-website/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php(54): Symfony\Component\HttpFoundation\Request->getAcceptableContentTypes() #4 /c/Users/User/Code/example-website/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php(44): Illuminate\Http\Request->wantsJson() #5 /c/Users/User/Code/example-website/vendor/laravel/framework/src/Illumina in /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php on line 61
This error is very expected and I've never seen it before in my project (or anywhere else for that matter).
How can I debug this issue?
As a sanity check, delete the vendor directory and then run composer install to re-fetch your dependencies and see if the error is resolved. If not, then attempt composer update to fetch the latest versions of your dependencies in which this issue may have been resolved.
I face an issue since last Friday. Everything was working fine on my project and then friday when deploying:
after
$> php bin/console cache:clear
My Symfony project doesn't work anymore. I got this error:
Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SensioFrameworkExtraBundle" from namespace "Sensio\Bundle\FrameworkExtraBundle".
Did you forget a "use" statement for another namespace? in /Users/dam/Development/Alara/rayflex/git/rayborn/src/Kernel.php:33
Stack trace:
#0 /Users/dam/Development/Alara/rayflex/git/rayborn/vendor/symfony/http-kernel/Kernel.php(492): App\Kernel->registerBundles()
#1 /Users/dam/Development/Alara/rayflex/git/rayborn/vendor/symfony/http-kernel/Kernel.php(132): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 /Users/dam/Development/Alara/rayflex/git/rayborn/vendor/symfony/framework-bundle/Console/Application.php(64): Symfony\Component\HttpKernel\Kernel->boot()
#3 /Users/dam/Development/Alara/rayflex/git/rayborn/vendor/symfony/console/Application.php(148): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /Users/dam/ in /Users/dam/Development/Alara/rayflex/git/rayborn/src/Kernel.php on line 33
I tried to delete my vendor and reinstall same error
I tried a composer selfupdate && composer update
I Also tried to put the use in kernel.php...
Still nothing
I took an old tag of my project who was working fine Some month back. Same error..
I have Fix my problem on reinstalling SenSio Bundle
$ composer require sensio/framework-extra-bundle
I can't explain why, it was already installed and in the composer.json before ..
Thank for your help !
I have a problem with PhpStorm. I had trouble adding the Composer and Symfony commands to PhpStorm.
I receive a message of this style:
Problem Failed to parse output as xml: Error on line 2: Content is not
allowed in prolog.. Command php /root/Downloads/composer.phar list
--format=xml Output Fatal error: Uncaught Error: Class 'DOMDocument' not found in
phar:///root/Downloads/composer.phar/vendor/symfony/console/Descriptor/XmlDescriptor.php:90
Stack trace:
0 phar:///root/Downloads/composer.phar/vendor/symfony/console/Descriptor/XmlDescriptor.php(166):
Symfony\Component\Console\Descriptor\XmlDescriptor->getApplicationDocument(Object(Composer\Console\Application),
NULL)
1 phar:///root/Downloads/composer.phar/vendor/symfony/console/Descriptor/Descriptor.php(55):
Symfony\Component\Console\Descriptor\XmlDescriptor->describeApplication(Object(Composer\Console\Application),
Array)
2 phar:///root/Downloads/composer.phar/vendor/symfony/console/Helper/DescriptorHelper.php(69):
Symfony\Component\Console\Descriptor\Descriptor->describe(Object(Symfony\Component\Console\Output\ConsoleOutput),
Object(Composer\Console\Application), Array)
3 phar:///root/Downloads/composer.phar/vendor/symfony/console/Command/ListCommand.php(81):
Symfony\Component\Console\Helper\DescriptorHelper->describe(Object(Symfony\Component\Console\Ou
in
phar:///root/Downloads/composer.phar/vendor/symfony/console/Descriptor/XmlDescriptor.php
on line 90
Can you help me find the solution please ?
The version of PHP needs to be recent. On macOS by default you may end up with PHP 5.6, and PHPStorm actually choose /usr/bin/php as it's preferred option for commands.
I'm having trouble while deploying my symfony web app on heroku, when previously it worked just fine. What could be wrong?
This is the build log: http://pastebin.com/DXZH110S
Here is the relevant part of the log:
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 Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SensioGeneratorBundle" from namespace "Sensio\Bundle\GeneratorBundle".
Did you forget a "use" statement for another namespace? in /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/app/AppKernel.php:25
Stack trace:
#0 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(403): AppKernel->registerBundles()
#1 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(113): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot()
#3 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Component/Console/Appli in /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/app/AppKernel.php on line 25
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 Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SensioGeneratorBundle" from namespace "Sensio\Bundle\GeneratorBundle".
Did you forget a "use" statement for another namespace? in /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/app/AppKernel.php:25
Stack trace:
#0 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(403): AppKernel->registerBundles()
#1 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(113): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot()
#3 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Component/Console/Appli in /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/app/AppKernel.php on line 25
Finally I solved, the problem was the system variable SYMFONY_ENV=prod not set.
https://devcenter.heroku.com/articles/getting-started-with-symfony#configuring-symfony-to-run-in-the-prod-environment