FatalErrorException: ParameterBag in Symfony2 - php

I just installed Symfony2 in my local server using XAMPP, and fixed all the recommendation extensions- APC and intl.
When I tried to access http://localhost/symblog/web/app_dev.php/. I got the following error.
FatalErrorException: Error: Class
'Symfony\Component\DependencyInjection\ParameterBag\ParameterBag' not
found in
/Applications/XAMPP/xamppfiles/htdocs/symblog/app/bootstrap.php.cache
line 2469
I don't know what's wrong with it. I try to googling but It doesn't have any information. Any suggestion would be appreciated.

Seems like you cache is broken or dependencies are missing. Try:
php app/console cache:clear
If nothing changes, try:
php composer.phar install

Related

Why Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found

I have a Laravel/Homestead project that is finally working locally. Now I'm trying to port it over to HostGator and can't get it running due to titled error. I've tried all the suggested solutions to no avail. Including:
composer require laravel/laravel
composer dump-autoload
composer install --no-scripts
composer update
composer update --no-scripts
Nothing works. Same error. If this is a clue, I also tried
php artisan clear-compiled
and get response of
Could not open input file: artisan
I'm about ready to give up on Laravel/Homestead. I've spent countless hours on this framework with nothing but problems to show for it. Would not recommend it to anybody.
You can see the error yourself here:
http://www.tekknow.net/MedAverter/medaverter/
Any suggestions before I throw in the towel?
For the artisan file, the artisan file is not required through includes, you have it in your root project, which is created when you create your Laravel project. Here is the file.
So you need to have that file in your project.
For the missing class, you try to require laravel/laravel but that is not the correct dependency. Again that github repo is a shell for a project, to have Laravel features you need to base of laravel/laravel and include laravel/framework.
Hope this clears up some confusing and can get you on the right track. Secondly you shouldn't port it over, but simply cloning your project and running composer install should be sufficient.
The problem turned out to be two issues.
1. The wrong version of PHP was running. If I ssh'ed into the hostgator server and did
php -v
It showed PHP 5.6.30 even though I had selected Php 7.1 in the cPanel PHP Selector. If I did
tekknow.net/phpinfo.php
it would say I was using 7.1. Called up HostGator tech support and they were able to change it to PHP 7.3.13.
Now if I do:
php artisan clear cache
I no longer get the error about
Parse error: syntax error, unexpected '?' in
/home1/sl1k7f3j/public_html/medaverter/bootstrap/app.php on line 15
which was an error caused by a version of php that doesn't support the ?? operator.
The second problem was a lack of memory issue. If I did
composer update
It would start to work but would fail in about 30 seconds with
Fatal error: Out of memory (allocated 709623808) (tried to allocate
34187559 bytes) in
phar:///opt/cpanel/composer/bin/composer/src/Composer/Json/JsonFile.php
on line 270
The HostGator tech rep could not figure out why that was happening but I got around that issue by manually uploading my local vendor folder to the host server.
Now when I go to http://tekknow.net/medaverter/ it works!

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.

PHP Fatal error: Class 'Bllim\Datatables\DatatablesServiceProvider'

I'm a newbie in Laravel. I just cloned my co-worker git and try to php artisan list but it gives me error
PHP Fatal error: Class 'Bllim\Datatables\DatatablesServiceProvider' not found in /Users/path-to-project/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 157
I can't find any documentations about this error and search results don't really help.
Any of you ever met this problem and care to help me fix this? Thank you.
Asking your coworker would be a first good step :)
That said, the error you're getting indicates that PHP can't find or autoload a Laravel Service provider class. If your coworker is following Laravel best practices, you should be able to fix this by running the following command from your root project directory (or the directory with a composer.json file)
$ composer install
or ...
$ composer.phhar install
The format of the command (phar or no phar) will depend on how you've installed composer, the dependency/package manager used in Laravel.

Laravel: PHP Fatal error: Class '...ServiceProvider' not found in /var/www/laravel/bootstrap/compiled.php on line #

I have been working on the same app for a little bit now, and I am moving it over to Laravel. This is not only my first experience with Laravel, but my first time using a PHP framework. It is awesome so far.
I have run into a problem in my testing, I am getting an error: Error Output: PHP Fatal error: Class '...ServiceProvider' not found in /var/www/laravel/bootstrap/compiled.php on line #
I am wondering what causes this error and how I can fix it . It gives me the direct line that is problematic. But I have no idea how to solve this issue.
I have tried a number of solutions including
composer install
composer update
composer dump-autoload
and others as well.
I have also attempted deleting the compiled.php file all together, but then it trips the same error on a different file. What is it causing this error, and how can I go about debugging it?
Thanks for help in advance!!
Try running the following command:
php artisan clear-compiled
If that gives you the same error, you'll have to manually delete the file:
rm app/bootstrap/compiled.php
For laravel 5.5.*
you can remove related ServiceProvider in this file
\bootstrap\cache\config.php

PHPUnit with Symfony Fatal error: Class 'Doctrine\Bundle\DoctrineBundle\DoctrineBundle' not found

I'm trying to testing my app made with Symfony. I wrote a test and when I launch it, i get the following error:
Fatal error: Class 'Doctrine\Bundle\DoctrineBundle\DoctrineBundle'
not found in /.../app/AppKernel.php on line 17
I had the same error with Symfony's MonologBundle, AsseticBundle and SwiftmailerBundle: then I've manually added these bundles into my app, so pheraps I have fixed those errors, but with Doctrine I've not found any solutions yet.
It looks like maybe you did not install the Doctrine bundle.
Try to go to the root of your project where the composer.phar is located through a console, and try to run it like this:
php composer.phar
It will install all dependencies of Symfony2,and hopefully everything is going to work :)

Categories