Class 'Appkernel' not found when updating to Symfony 3.0 - php

I tried updating my code and structure to Symfony 3.0. Doing the usual composer update, I've got this error when composer execute post-update-cmd :
Fatal error: Class 'AppKernel' not found in C:\wamp\www\tharmofos\bin\console on line 20
Call Stack:
0.0002 235192 1. {main}() C:\wamp\www\tharmofos\bin\console:0
Fatal error: require_once(): Failed opening required 'C:\wamp\www\tharmofos\vendor\jms\security-extra-bundle\Tests\Functiona
l/../../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\wamp\www\tharmofos\vendor\jms\security-extra-bundle\Tests\
Functional\AppKernel.php on line 5
Call Stack:
0.0002 235192 1. {main}() C:\wamp\www\tharmofos\bin\console:0
0.0249 1144472 2. Symfony\Component\Debug\ErrorHandler::handleFatalError() C:\wamp\www\tharmofos\vendor\symfony\sym
fony\src\Symfony\Component\Debug\ErrorHandler.php:0
0.0263 1162640 3. Symfony\Component\Debug\ErrorHandler->handleException() C:\wamp\www\tharmofos\vendor\symfony\symf
ony\src\Symfony\Component\Debug\ErrorHandler.php:600
0.0292 1260456 4. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->handleError() C:\wamp\w
ww\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\ErrorHandler.php:530
0.0292 1262144 5. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->getClassCandidates() C:
\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler.php:
62
2.5849 1595232 6. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->findClassInPath() C:\wa
mp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler.php:118
2.6446 1600616 7. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->convertFileToClass() C:
\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler.php:
143
2.6453 1642120 8. require_once('C:\wamp\www\tharmofos\vendor\jms\security-extra-bundle\Tests\Functional\AppKernel.p
hp') C:\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandl
er.php:188
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated wit
h an exception
[RuntimeException]
An error occurred when executing the ""cache:clear --no-warmup"" command:
Fatal error: Class 'AppKernel' not found in C:\wamp\www\tharmofos\bin\console on line 20
Call Stack:
0.0002 235192 1. {main}() C:\wamp\www\tharmofos\bin\console:0
Fatal error: require_once(): Failed opening required 'C:\wamp\www\tharmofos\vendor\jms\security-extra-bundle\Tests\Func
tional/../../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\wamp\www\tharmofos\vendor\jms\security-extra-bun
dle\Tests\Functional\AppKernel.php on line 5
Call Stack:
0.0002 235192 1. {main}() C:\wamp\www\tharmofos\bin\console:0
0.0249 1144472 2. Symfony\Component\Debug\ErrorHandler::handleFatalError() C:\wamp\www\tharmofos\vendor\symfon
y\symfony\src\Symfony\Component\Debug\ErrorHandler.php:0
0.0263 1162640 3. Symfony\Component\Debug\ErrorHandler->handleException() C:\wamp\www\tharmofos\vendor\symfony
\symfony\src\Symfony\Component\Debug\ErrorHandler.php:600
0.0292 1260456 4. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->handleError() C:\w
amp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\ErrorHandler.php:530
0.0292 1262144 5. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->getClassCandidates
() C:\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHa
ndler.php:62
2.5849 1595232 6. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->findClassInPath()
C:\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandl
er.php:118
2.6446 1600616 7. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->convertFileToClass
() C:\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHa
ndler.php:143
2.6453 1642120 8. require_once('C:\wamp\www\tharmofos\vendor\jms\security-extra-bundle\Tests\Functional\AppKer
nel.php') C:\wamp\www\tharmofos\vendor\symfony\symfony\src\Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatal
ErrorHandler.php:188
As of now, I tried to delete the vendor folder and did a composer install but I keep getting this error.
When I try accessing my website, I get this error :
Fatal error: Class 'Symfony\Bundle\FrameworkBundle\FrameworkBundle' not found in C:\wamp\www\tharmofos\app\AppKernel.php on line 11
I think it's a problem with the structure update.
Do you have any clue ?

I found out how to get rid of this error by autoloading AppKernel.php in composer.json : https://github.com/symfony/symfony-standard/issues/868

If it can help, I often forget to upgrade a Symfony Standard file (like app/console, web/app.php, web/app_dev.php, app/config/routing_dev.yml...) when upgrading a project to 3.0.
It leads to this error.

Related

I am trying execute Phpunit command but give me error

I am trying to execute PHPUNIT command but it give me error.
I am using Laravel and Laragon virtual host.
Cannot load Xdebug - it was already loaded
Warning: is_dir() expects parameter 1 to be a valid path, object given in C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\Ru nner\BaseTestRunner.php on line 56
Call Stack:
0.0007 353808 1. {main}() C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\phpunit:0
0.0146 728568 2. PHPUnit\TextUI\Command::main() C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\phpunit:53
0.0146 733128 3. PHPUnit\TextUI\Command->run() C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php: 148
0.1731 4128288 4. PHPUnit\TextUI\TestRunner->getTest() C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Comma nd.php:169
0.1731 4128288 5. is_dir() C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\Runner\BaseTestRunner.php:56
Catchable fatal error: Object of class PHPUnit\Framework\TestSuite could not be converted to string in C:\Users\chavoshi\AppData\Roaming\Composer\ vendor\phpunit\phpunit\src\Runner\StandardTestSuiteLoader.php on line 32
Call Stack:
0.0007 353808 1. {main}() C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\phpunit:0
0.0146 728568 2. PHPUnit\TextUI\Command::main() C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\phpunit:53
0.0146 733128 3. PHPUnit\TextUI\Command->run() C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php: 148
0.1731 4128288 4. PHPUnit\TextUI\TestRunner->getTest() C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Comma nd.php:169
0.2650 4128824 5. PHPUnit\TextUI\TestRunner->loadSuiteClass() C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\Runne r\BaseTestRunner.php:71
0.2690 4143096 6. PHPUnit\Runner\StandardTestSuiteLoader->load() C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\Ru nner\BaseTestRunner.php:130
0.2690 4143144 7. str_replace() C:\Users\chavoshi\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\Runner\StandardTestSuiteLoader.php: 32
can anybody help me?
I execute this line of command and solve my problem?
vendor\bin\phpunit tests\UserTest

How do I add a new APP_KEY to a Laravel project?

I recently was reading this Stack Overflow post
When to generating a New Application Key in Laravel?
where colleagues mentioned that you can run:
php artisan key:generate
and this will generate a new APP_KEY for your cloned Laravel project. This being a legitimate concern when collaborating and using Github for version control, however, when I tried to run that command I got this error:
ldco2016#DCortes-MacBook-Pro-3 ~/Projects/photogallery (master)$ php artisan key:generate [ruby-2.2.1]
PHP Warning: require(/Users/ldco2016/Projects/photogallery/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /Users/ldco2016/Projects/photogallery/bootstrap/autoload.php on line 17
PHP Stack trace:
PHP 1. {main}() /Users/ldco2016/Projects/photogallery/artisan:0
PHP 2. require() /Users/ldco2016/Projects/photogallery/artisan:16
Warning: require(/Users/ldco2016/Projects/photogallery/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /Users/ldco2016/Projects/photogallery/bootstrap/autoload.php on line 17
Call Stack:
0.0002 240112 1. {main}() /Users/ldco2016/Projects/photogallery/artisan:0
0.0003 242776 2. require('/Users/ldco2016/Projects/photogallery/bootstrap/autoload.php') /Users/ldco2016/Projects/photogallery/artisan:16
PHP Fatal error: require(): Failed opening required '/Users/ldco2016/Projects/photogallery/bootstrap/../vendor/autoload.php' (include_path='.:') in /Users/ldco2016/Projects/photogallery/bootstrap/autoload.php on line 17
PHP Stack trace:
PHP 1. {main}() /Users/ldco2016/Projects/photogallery/artisan:0
PHP 2. require() /Users/ldco2016/Projects/photogallery/artisan:16
Fatal error: require(): Failed opening required '/Users/ldco2016/Projects/photogallery/bootstrap/../vendor/autoload.php' (include_path='.:') in /Users/ldco2016/Projects/photogallery/bootstrap/autoload.php on line 17
Call Stack:
0.0002 240112 1. {main}() /Users/ldco2016/Projects/photogallery/artisan:0
0.0003 242776 2. require('/Users/ldco2016/Projects/photogallery/bootstrap/autoload.php') /Users/ldco2016/Projects/photogallery/artisan:16
So its not so straightforward and error free. Can anyone lend a hand as to how to generate a new APP_KEY when working on a cloned Laravel project?
You must first install composer and run composer install so that laravel can access the commands.

Symfony 2.7: [RuntimeException]An error occurred when generating the bootstrap file

After clonning a Symfony 2.7 project that I use to develop and install succesfully, when I now run
comopser install
I get the following error:
PHP Stack trace:
PHP 1. {main}() /opt/lampp/htdocs/IAG/vendor/sensio/distribution- bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php:0
PHP 2. require_once() /opt/lampp/htdocs/IAG/vendor/sensio/distribution- bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php:56
PHP Fatal error: require_once(): Failed opening required '/opt/lampp/htdocs/IAG/app/../vendor/Zend/Loader/Autoloader.php' (include_path='/opt/lampp/htdocs/IAG/app/../vendor:.:/usr/share/php:/usr/share/pear') in /opt/lampp/htdocs/IAG/app/autoload.php on line 14
PHP Stack trace:
PHP 1. {main}() /opt/lampp/htdocs/IAG/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php:0
PHP 2. require_once() /opt/lampp/htdocs/IAG/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php:56
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when generating the bootstrap file.
I don't know what is really wrong

Symfony - Unable to create new project using installer

I'm trying to learn Symfony but so far just keep getting hung up on installation and things other than the actual development of my app.
I try to create a new Symfony project on my Windows machine using the installer. I'm following the instructions exactly as it says in the book. I can successfully download the symfony.phar but when I run:
php symfony.phar
I get the following error:
PHP Warning: Phar::mapPhar(symfony.phar): failed to open stream: No such file or directory in symfony.phar on line 9
PHP Stack trace:
PHP 1. {main}() symfony.phar:0
PHP 2. Phar::mapPhar() symfony.phar:9
Warning: Phar::mapPhar(symfony.phar): failed to open stream: No such file or directory in symfony.phar on line 9
Call Stack:
0.0017 227224 1. {main}() symfony.phar:0
0.0017 227920 2. Phar::mapPhar() symfony.phar:9
PHP Fatal error: Uncaught exception 'PharException' with message 'unable to open phar for reading "symfony.phar"' in symfony.phar:9
Stack trace:
#0 symfony.phar(9): Phar::mapPhar('default.phar')
#1 {main}
thrown in symfony.phar on line 9
Fatal error: Uncaught exception 'PharException' with message 'unable to open phar for reading "symfony.phar"' in symfony.phar on line 9
PharException: unable to open phar for reading "symfony.phar" in symfony.phar on line 9
Call Stack:
0.0017 227224 1. {main}() symfony.phar:0
0.0017 227920 2. Phar::mapPhar() symfony.phar:9
I can't find anything that helps with this.
The reason appears to be that in my Windows command prompt I was in a sub directory of C:\Users\Me\My Documents. Neither the symfony.phar, nor Composer will work from this directory. It has to be from C:\Users\Me\Documents which is the actual phsyical location, as opposed to My Documents which is just a virtual directory.
I don't know the technicalities of exactly why it doesn't work though.

Yii functional testing errors

So, I'm learning the book "Agile web-dev with Yii", and example of functional testing from that book produces the error below:
Warning: require_once(Symfony/Component/Yaml/autoloader.php): failed to open stream: No such file or directory in D:\web\server\php\pear\PHPUnit\Autoload.php on line 69
Call Stack:
0.0004 326184 1. {main}() D:\web\server\php\phpunit:0
0.0011 367616 2. require('D:\web\server\php\pear\PHPUnit\Autoload.php') D:\web\server\php\phpunit:43
Fatal error: require_once(): Failed opening required 'Symfony/Component/Yaml/autoloader.php' (include_path='.;D:\web\server\php\pear') in D:\web\server\php\pear\PHPUnit\Autoload.php on line 69
Call Stack:
0.0004 326184 1. {main}() D:\web\server\php\phpunit:0
0.0011 367616 2. require('D:\web\server\php\pear\PHPUnit\Autoload.php') D:\web\server\php\phpunit:43
I've spent a lot of time to fix this error, and I have no idea what to do.
I had the same problem while upgrading my phpunit.
This solved the problem:
pear channel-discover pear.symfony.com
pear install pear.symfony.com/Yaml
Then run:
pear install --alldeps pear.phpunit.de/PHPUnit
Hope this will solve your problem.

Categories