Closed ngohungphuc closed 6 years ago
I have the same issue, cannot load service, class "config" does not exist - using laravel/framework (v5.2.15):
vagrant@engltr:~/engltr$ php artisan vendor:publish PHP Fatal error: Uncaught ReflectionException: Class config does not exist in /home/vagrant/engltr/vendor/laravel/framework/src/Illuminate/Container/Container.php:738 Stack trace:
Fatal error: Uncaught ReflectionException: Class config does not exist in /home/vagrant/engltr/vendor/laravel/framework/src/Illuminate/Container/Container.php:738 Stack trace:
i also ever have same issue, but after i try to remove this code :
$app->register(\Barryvdh\DomPDF\ServiceProvider::class);
and
$app->configure('dompdf');
from bootstrap/app.php the problem solved. And don't forget to add
use PDF
in your controller... hope this will help you
Hi,
I also got the same error while creating an controller on laravel project say,
"vagrant@homestead:~/$ php artisan make:controller
The error can be solved!!!
go to /code/laravelproject/config/app.php and edit with
just including provider within ' ' for specifing respective provider name with in the array
Thanks..
I'm having this same problem with bootstrap/app.php
$app->register(\Barryvdh\DomPDF\ServiceProvider::class); $app->configure('dompdf');
Do not include $app->register(\Barryvdh\DomPDF\ServiceProvider::class); and $app->configure('dompdf'); in bootstrap/app.php if you are installing for Laravel. They are not part of the install requirement. They are for Lumen
run
>composer dump-autoload
Or
composer dump-autoload -o
This solved the issue for me
Thanx @peterw35 , I had the same issue beacause I put:
if (env('APP_DEBUG')) { $app->register(Barryvdh\Debugbar\LumenServiceProvider::class); }
In my bootstrap/app.php file.
Can you just tell me where to put this code now ?
Thx
@Kleinast you should've open the issue in Barryvdh's Debugbar project, not here.
but the principle is the same. if you are using laravel, do NOT follow any Lumen instructions. Lumen is NOT laravel. (to be precise, it's a cut down version. It's got minimal packages included for performance)
in my case it was because i havent given 777 permission to bootstrap/cache/services.php file after giving permission my project was working fine hope it helps you :)
For me, if you change or update APP_NAME in your .env file with spaces like My Awesome, make sure that you enclose it with " (quote).
@ryscript really weird error I have not read this I've never found this mistake Thanks
same error has also happened if you don't have conf/datatables.php. try installing latest or above 7.x
composer require yajra/laravel-datatables-oracle
add these lines in config/app.php
Yajra\Datatables\DatatablesServiceProvider::class,
Datatables' => Yajra\Datatables\Facades\Datatables::class,
php artisian config:cache
if you don't have file config/datables.conf. Try to paste these file there. https://gist.github.com/hsali/1cab0d6c81020bf7bce043b65f94373a
I was facing the same issue.
"Uncaught ReflectionException: Class config does not exist"
I have figured out this, here is the solution: There may be some error in your environment file It could be any extra character, which is causing error. In my case it was space. I have changes space character to nbsp In your it can be any other character;
To find the error, Run this command
php artisan cache:clear
Output is like this:
[Dotenv\Exception\InvalidFileException]
Dotenv values containing spaces must be surrounded by quotes.
I have changes the below line(changes space to nbsp) NOTE:Please write nbsp to "amp%nbsp;" change amp% to & as character(As this page is not rendering it correctly) MAIL_FROM_NAME=Tarun Kumar To MAIL_FROM_NAME=Tarunamp%nbsp;Kumar
I got this same issue, but not related to phpunit. The issue was I added values containing spaces to my .env file. If you have values contains spaces in your .env file, surround them with quotes and then it'll be fixed.
if you run php artisan clear-compiled while having this issue, it will tell the solution ;)
check your apache user and file system user first.
then run the following command for ur file system permission.
sudo chmod 755 storage -R
sudo chmod 755 vendor -R
sudo chmod 755 bootstrap -R
After you finished the change the file permission.
make sure for your cache. if possible, clean your chache with the following command .
php artisan config:cache
php artisan cache:clear
php artisan config:clear
it works for me.
in my case there was a error in the .env file
I had an error in .env
file too. In my case an error was due to space character in value without quotes. Like:
MY_ENV_OPTION=John Smith
You need to add quotes like so:
MY_ENV_OPTION="John Smith"
And error will go away.
@gugglegum Thanks! That was actually what made a setup throw the exception for me too. Weird unusable error messages...
I'm also having the same error in .env file with APP_NAME.
@ryscript you are a lifesaver!
Had same problem and i've deleted bootstrap/cache/config.php and ran php artisan clear-compiled
, now it's working fine
If all the above failed for you, delete all files in project/bootstrap/cache/
and run composer du -o
afterwards. That fixed things in my case.
I encounter the same issue after changing APP_NAME in .env file, silly me!
I had also the same problem and I follow all answers in Github and Stackoverflow but no thing was helped. But when I saw @detal92 's comment, I opened bootstrap/app.php and see what's modules are registered in it ! so I found that Debug Module is registred in app.php, so I disabled Debug in .env file like this :
APP_DEBUG=false
then I run this command :
> php artisan config:cache
and finally :
APP_DEBUG=true
and now all works fine 😄
Had same problem and i've deleted bootstrap/cache/config.php and ran
php artisan clear-compiled
, now it's working fine
This works for me!
Good Grief!!!! How long is is this issue going to go on? Whay form of begging/bribery/weeping will get Laravel to fix this!!!!!!!!
I got this same issue, but not related to phpunit. The issue was I added values containing spaces to my .env file. If you have values contains spaces in your .env file, surround them with quotes and then it'll be fixed.
if you run php artisan clear-compiled while having this issue, it will tell the solution ;)
Same here. Having a space in one of the config would do it
test=abc abc
i also ever have same issue, but after i try to remove this code :
$app->register(\Barryvdh\DomPDF\ServiceProvider::class);
and$app->configure('dompdf');
from bootstrap/app.php the problem solved. And don't forget to adduse PDF
in your controller... hope this will help you
Thanks, It worked in my case.
I have an issue like this i'm using laravel 5.How can i fix it.Thanks for help