Interface 'Symfony\Component\HttpKernel\HttpKernelInterface' not found - php

After upgrading from Symfony 2.3 to 2.8 I get the following error:
Fatal error: Interface
'Symfony\Component\HttpKernel\HttpKernelInterface' not found in
app/bootstrap.php.cache on line 2629
Already tried removing the vendor folder and doing a composer install.
Any ideas?

Have you tried removing cached code? It seems like you've procompiled your application into one file bootstrap.php.cache. Have you tried removing it.
Otherwise it is always a good idea to do two of the following commands:
php composer.phar dump-autoload - update autolod file
php app/console cache:clear - removes cache

I had to add the following line to web/app.php and web/app_dev.php:
$loader = require __DIR__.'/../app/autoload.php';
And also update app/console.
Found this by comparing my files with a fresh install of Symfony 2.8

Related

Undefined offset at PhpMatcherTrait

My project was working perfect. I wanted to write some new lines of code today but it gives me this error.
ErrorException: Notice: Undefined offset: 6
at vendor/symfony/routing/Matcher/Dumper/PhpMatcherTrait.php:87
I have totally no idea what that is.
Checked what I was doing last when it was still working. I tried to configure authentication and registration form so according to tutorial I used these lines in terminal:
composer require symfony/security-csrf
composer require symfony/security-bundle
php bin/console make:user
php bin/console make:migration
php bin/console doctrine:migrations:migrate
composer update
Thats simply everything I did.
I am using Symfony 4.1 and PHP 7.1.3
This is a fresh project, with one view, one controller, it was working fine so far.
Will appreciate any help on this.
I had the same error after doing a composer update. Running php bin/console cache:clear in the terminal resolved it for me.
Seems like that something has updated, - most likely Composer.
Try deleting your vendor folder and do a composer install.

class 'Former\FormerServiceProvider' not found - Laravel

i'm trying to install the anahkiasen/former package once again but it won't work. The funny thing is, I downloaded it about a weak ago and it was working perfectly. My code if finished and use's this former package. I tried to install a new package a half hour ago and since this the former class isn't found anymore.
Like I mentioned it, it was working perfectly before, but since I did a composer update it doesn't work.
Well I did what they said over here:
https://github.com/formers/former/wiki/Getting-started
first I run this::
composer require anahkiasen/former:4.0.*#dev
then a composer update
after the update I add this in my config/app.php provider section:
Former\FormerServiceProvider::class,
and this in the alias section:
'Former' => 'Former\Facades\Former',
I tried it but it still doesn't work. Just getting
Class 'Former\FormerServiceProvider' not found
as an output
I removed the package I wanted to install before and found another way.. But the problem with the former class is still there.
Thanks for any help!
Terminal outputs:
/var/www/laravel# php composer.phar require anahkiasen/former
gives:
Using version ^4.0 for anahkiasen/former
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
-------- then I added the provider/alias --- after this:
composer update --no-scripts
gives
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
composer dump-autoload
gives of course:
Generating autoload files
/var/www/laravel/logs# php artisan config:publish anahkiasen/former
gives:
PHP Fatal error: Class 'Former\FormerServiceProvider' not found in /var/www/laravel/logs/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Former\FormerServiceProvider' not found
note that I changed the directory in the last command
Let's start from the beginning.
Follow below steps:-
1) Run below command in terminal:-
composer.phar require anahkiasen/former
2) It'll ask you for the version, type dev-master
3) Add Former's service provider to your Laravel application in app/config/app.php. In the providers array add :
'Former\FormerServiceProvider',
Add then alias Former's main class by adding its facade to the aliases array in the same file :
'Former' => 'Former\Facades\Former',
4) run composer update --no-scripts
After that, run composer dump-autoload, and that should work.
If not working then run this command:-
php artisan config:publish anahkiasen/former
Hope it will help you :)

Uninstall FOSHttpCacheBundle

I installed FOSHttpCacheBundle and decided to try to remove it afterwards.
I ran the composer remove (my composer.json does not contain the FOSHttp line anymore)
I removed the line in the AppKernel.php
I removed the corresponding lines in config.yml
Yet now, in production mode, I get the following error:
Fatal error: Class 'FOS\HttpCacheBundle\EventListener\CacheControlSubscriber' not found in C:\wamp\www\Symfony\vendor\symfony\symfony\src\Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher.php on line 145
It stacks up from the bootstrap.php file which I rebuilt using composer install.
Should I re-install FOSHttpCacheBundle?

Fatal error: Class 'Illuminate\Foundation\Application' not found

I am getting following error when I open my site which is made using laravel 5
Fatal error: Class 'Illuminate\Foundation\Application' not found in C:\cms\bootstrap\app.php on line 14
I have tried removing vendor folder and composer.lock file and running composer install it's not working I tried running PHP artisan optimize but it shows error
Fatal error: Class'Illuminate\Foundation\Application' not found
Is there any way to solve this problem?
Edited:
This problem aroused as soon as I used the php artisan make:model Page command which did create the model but then the above error gets displayed when I access the site
Also If use the Laravel's Local Development Server no such problem arises only if I use wamp server
In my situation, I didn't have the full vendor dependencies in place (composer file was messed up during original install) - so running any artisan commands caused a failure.
I was able to use the --no-scripts flag to prevent artisan from executing before it was included. Once my dependencies were in place, everything worked as expected.
composer update --no-scripts
Just in case I trip over this error in 2 weeks again...
My case: Checkout an existing project via git and pull in all dependencies via composer. Came down to the same error listed within the title of this post.
Solution:
composer dump-autoload
composer install --no-scripts
make sure everything works now as expected (no errors!)
composer update
Something is clearly corrupt in your Laravel setup and it is very hard to track without more info about your environment. Usually these 2 commands help you resolve such issues
php artisan clear-compiled
composer dump-autoload
If nothing else helps then I recommend you to install fresh Laravel 5 app and copy your application logic over, it should take around 15 min or so.
Easy as this, that worked for my project
Delete /vendor folder
and execute composer install
then run project php artisan serve
In my case composer was not installed in that directory. So I run
composer install
then error resolved.
or you can try
composer update --no-scripts
cd bootstrap/cache/->rm -rf *.php
composer dump-autoload
I just fixed this problem (Different Case with same error),
The answer above I tried may not work because My case were different but produced the same error.
I think my vendor libraries were jumbled,
I get this error by:
1. Pull from remote git, master branch is codeigniter then I do composer update on master branch, I wanted to work on laravel branch then I checkout and do composer update so I get the error,
Fatal error: Class 'Illuminate\Foundation\Application' not found in
C:\cms\bootstrap\app.php on line 14
Solution:
I delete the project on local and do a clone again, after that I checkout to my laravel file work's branch and do composer update then it is fixed.
I had accidentally commented out:
require __DIR__.'/../bootstrap/autoload.php';
in
/public/index.php
When pasting in some debugging statements.
For latest laravel version also check your version because I was also
facing this error but after update latest php version, I got rid from
this error.
run composer require laravel/framework after composer install then php artisan key:generate its work for me in kali linux
I can't imagine that anyone else reading this is a stupid as I was but just in case...
I had accidentally removed "laravel/framework": "^5.6" from my composer.json when resolving merge conflicts.
please test below solution:
first open command prompt cmd ==> window+r and go to the location where laravel installed.
try composer require laravel/laravel
i was having same problem with this error.
It turn out my Kenel.php is having a wrong syntax when i try to comply with wrong php8 syntax
The line should be
protected $commands = [
//
];
instead of
protected array $commands = [
//
];
#kalhan-toress 's comment is what ACTUALLY WORKED FOR ME
remove /bootstrap/start.php,composer.lock, and the vendor and run composer install
In my case, the error was caused on initial deployment because I didn't have a .env file in that directory (because those don't belong on Github where the files were transferred from).
check your .env file i think you miss something. Maybe like this
if yes then need to add manually and composer update or install composer

Symfony2 config.php troubles: Notice: Undefined property: stdClass::$vendor-dir, Vendor libraries are missing, how to resolve?

today, after a while, I decided to create a new Symfony2 project. I have composer installed at /usr/local/bin/composer and it is updated to its latest version:
$ composer self-update
You are already using composer version etc, etc...
Then I have typed the usual command:
composer create-project symfony/framework-standard-edition path/to/htdocs/PDFMonitor
All went good:
...
Clearing the cache for the dev environment with debug true
Trying to install assets as symbolic links.
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
The assets were installed using symbolic links.
Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution
The assets were installed using symbolic links.
Then I opened the browser and made a request to the symfony's config.php to be sure that actually everything was smooth, but I got this Major Problem error:
And this PHP notice and warning:
Notice: Undefined property: stdClass::$vendor-dir in /path/to/htdocs/PDFMonitor/app/SymfonyRequirements.php on line 751
Notice: Undefined property: stdClass::$vendor-dir in /path/to/htdocs/PDFMonitor/app/SymfonyRequirements.php on line 751
Warning: file_get_contents(/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php): failed to open stream: No such file or directory in /path/to/htdocs/PDFMonitor/app/SymfonyRequirements.php on line 546
I do not know why this is happening. I didn't use Symfony for a while, but I never had such a problem.
What I tried:
Run either composer install and composer update inside the project's root. Didn't help.
Reinstall composer curl -s https://getcomposer/installer | php and then:
$ mv composer.phar /usr/local/bin
$ rm -R /path/to/htdocs/PDFMonitor`
and again:
$ composer create-project symfony/framework-standard-edition path/to/htdocs/PDFMonitor
Again the project is created but opening http://localhost/PDFMonitor/web/config.php gave the previous errors.
As I said I never experienced this problem before.
What should I do in order to make symfony work properly again? Why Symfony doesn't see the vendors?
I found a solution to the problem: this is a bug in Symfony 2.6, actually 2.7 seem to have fixed it.
If someone still creates a project with composer create-project symfony/framework-standard-edition ..., where the Symfony2 version defaults to 2.6 and experiences the same problem I have faced, here is a workaround:
Either edit YourProject/app/SymfonyRequirements.php line 406 and
YourProject/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php line 406 and replace:
is_dir($this->getComposerVendorDir()),
With this:
is_dir(__DIR__.'/../vendor/composer'),
This will remove the Major Problem complaining about the vendors. Then this will instead remove the file_get_contents() Warning:
Inside YourProject/app/SymfonyRequirements.php and make line 546 look like this:
file_get_contents(__FILE__) === file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'),
Then open localhost/YourProject/web/config.php and you will see the nice Symfony Welcome page again.

Categories