Laravel 5.6: Uncaught ReflectionException: Class env does not exist - php

When running my Laravel 5.6 application on it's production server, I'm getting an error as follows both in the browser and in the console when trying to run artisan commands:
PHP Fatal error: Uncaught ReflectionException: Class env does not exist in /var/www/html/service.straightlinefernie.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php:767
Stack trace:
#0 /var/www/html/service.straightlinefernie.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php(767): ReflectionClass->__construct('env')
#1 /var/www/html/service.straightlinefernie.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php(646): Illuminate\Container\Container->build('env')
#2 /var/www/html/service.straightlinefernie.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php(601): Illuminate\Container\Container->resolve('env', Array)
#3 /var/www/html/service.straightlinefernie.com/dev/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(734): Illuminate\Container\Container->make('env', Array)
#4 /var/www/html/service.straightlinefernie.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php(1210): Illuminate\Foundation\Application->m in /var/www/html/service.straightlinefernie.com/dev/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 767
The app runs fine on my development environment. I've combed my .env and config/ files for errors, and it all appears good.
I'm guessing there is something missing in my server set up, but
the main problem as I see it is that this error message is too generic and doesn't provide the information required to discover what specific file or error is actually making the boot process fail.
The stack trace is not even saved in the log file, and appears only in the console when I try to run artisan commands.
Does anyone know how to get a more detailed error message that can actually help me solve this error?
Perhaps there is a way to edit the file Illuminate/Container/Container.php so that it gives me more info?
Thanks

If composer dump-autoload -o and php artisan config:clear doesn't work then check your .env for potential errors like this:
KEY=THE VALUE
Should be
KEY="THE VALUE"

I faced this issue and found issue in config folder > constants file I was wrote "asset('/')" and "url()" function in config file, we can't write such functions in config.
Hope this answer will some one who stuck like this errors.

Related

Fatal error: Uncaught Error: Class 'MyClass' not found (webserver -> error, locahost -> all good)

I am getting error
Fatal error: Uncaught Error: Class 'MyClass' not found in /home/x/domain.com/x/x/init.php:3 Stack trace: #0 /home/x/domain.com/x/login.php(6): require_once() #1 {main} thrown in /home/x/domain.com/x/x/init.php on line 3
The thing is, I can run it in XAMPP on localhost without problems, I even ran it on the webserver before. The only thing I did is: deleted DB & files from webserver and 1:1 copied from XAMPP to the webserver and by that moment, I am getting this error.
I have edited things like DB connection etc, there is no error at all ** I THINK ** (since it is running fine in the XAMPP, PHP version is same on webserver as XAMPP (7.3)).
Webserver is running on Namecheap, it is shared hosting, so it is Litespeed server
mainfolder/index.php which is redirecting to login.php (mainfolder/clients/login.php) & login is calling init.php which is in clients/iip/init.php. require_once 'iip/init.php'; (i tried even './iip/init.php') and that 'user' class is located in iip/functions.php called from iip/init.php ( require_once 'functions.php'; )
EDIT: I tried to access init.php at the working XAMPP side and i am getting the same error, BUT site is still working, i am confused
Are you sure you specified your DocumentRoot (in apache config file) correctly?
It seems that your web server can't find specified file or MyClass is not defined in specified file.
You are probably making a mistake specifying the file path. The file path could be like "localhost/functions.php".
Also, after uploading the files to the server, are you sure that you can make the database connection without any problems?

Unable to read the "../.dev.env" environment file in Dotenv.php:symfony

I want To run a symfony project in my computer but I get all times errors , and now I get this error and i didn't find any solution for my problem
Problem Failed to parse output as xml: Error on line 2: Content is not
allowed in prolog.. Command C:\xampp\php\php.exe
C:\xampp\htdocs\buzzaka\bin\console list --format=xml Output
Fatal error: Uncaught
Symfony\Component\Dotenv\Exception\PathException: Unable to read the
"C:\xampp\htdocs\buzzaka\bin/../.dev.env" environment file. in
C:\xampp\htdocs\buzzaka\vendor\symfony\dotenv\Dotenv.php:466 Stack
trace:
0 C:\xampp\htdocs\buzzaka\vendor\symfony\dotenv\Dotenv.php(51): Symfony\Component\Dotenv\Dotenv->doLoad(false, Array)
1 C:\xampp\htdocs\buzzaka\bin\console(38): Symfony\Component\Dotenv\Dotenv->load('C:\xampp\htdocs...')
2 {main} thrown in C:\xampp\htdocs\buzzaka\vendor\symfony\dotenv\Dotenv.php on line 466
If u move your file from the folder where it was created symfony will keep looking for it on this folder, i've went on autoload_runtime and changed on $runtime variable where the project is, just worked for me, lets see on the last composer dump what just happens haha
The error is quite explicit, do you have a file C:\xampp\htdocs\buzzaka\bin/../.dev.env ?
Well, you need to create one. As announced a little while ago, Symfony will now require a .env file per environment. As you are running your command in the dev environment, you need to create a .dev.env file.

Laravel 5 Class Log Could not be Found

I am elbows deep in Laravel 5 and it's proving to be quite the bugger with the lack of autoloading. I am running into the weirdest of errors. I can't Log anything on my localhost. If it's a PHP error, it logs just fine, but if I try to write to the log, it throws an error. It's a Windows so no File Permission errors. Here's the error I get:
[2015-02-11 20:09:40] production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'App\Http\Controllers\Log' not found' in C:\xampp\htdocs\bg_checks\laravel\app\Http\Controllers\BgInfoController.php:44
Stack trace:
#0 C:\xampp\htdocs\bg_checks\laravel\storage\framework\compiled.php(1721): Illuminate\Foundation\Bootstrap\HandleExceptions->fatalExceptionFromError(Array)
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
Laravel 5 is still pretty new so there's not a lot of info on it. I've tried to find something and can only find a forum on Laracast's forum and nothing they suggested worked.
Help!
I don't think you have a Log class file in App\Http\Controllers directory. So you must add
use Log;
if you are using Laravel's logger, or
use Path\To\Your\Log;
for a custom logger.

Doctrine error when deploying symfony2 app on pagoda box

I'm getting a doctrine error after deploying my app on PagodaBox. It works fine in both dev and prod environments on my local machine but the live site returns this error:
Fatal error: Uncaught exception 'LogicException' with message 'Illegal value passed (no array or string given)' in /var/www/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php:101 Stack trace: #0 /var/www/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php(101): spl_autoload_register(NULL) #1 /var/www/app/bootstrap.php.cache(2275): Doctrine\Bundle\DoctrineBundle\DoctrineBundle->boot() #2 /var/www/app/bootstrap.php.cache(2303): Symfony\Component\HttpKernel\Kernel->boot() #3 /var/www/web/app.php(23): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #4 {main} thrown in /var/www/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php on line 101
The cache is cleared every time the app is deployed.
Any suggestions would be gratefully received because I'm totally stumped!
UPDATE:
I've done some more debugging and I have discovered that even in the prod environment the kernel.cache_dir parameter is set to /var/www/app/cache/dev. This means that the doctrine cache dir is being incorrectly set as it relies on this other parameter. I thought the kernel.cache_dir was set automatically depending on the environment.
I finally got this sorted. It was down to using eAccelerator as my opcode cache. It turns out that there is a bug in eAccelerator that means it can't process closures correctly. I'm now using XCache and it is all working fine.
This is the auto-loading failing in DoctrineBundle.php Line 101:
$this->autoloader = Autoloader::register($dir, $namespace, $proxyGenerator);
Your passing NULL to the $dir argument, which judging by the exception its requires either an array() or string.
You can see that the method uses $dir from the configuration variable doctrine.orm.proxy_dir (Line 64).
$dir = $this->container->getParameter('doctrine.orm.proxy_dir');`
My guess is that you have not defined this path correctly
Edit - Take a look here for Doctrine's configuration which includes the proxy_dir setting.

Errors when installing AjaXplorer

I am trying to install AjaXplorer but running in to problems. The first run test asks me to set my locale to UTF-8 but I am not sure how to do this.
If I skip the warning I get the following error and wondered if it has something to do with it.
Exception thrown within the exception handler! Message was: Cannot find plugin text for type log in C:\UniServer\www\domain\secure\core\classes\class.ConfService.php on line 164 #0 C:\UniServer\www\domain\secure\core\classes\class.ConfService.php(184): ConfService->initUniquePluginImplInst('LOG_DRIVER', 'log') #1 C:\UniServer\www\domain\secure\core\classes\class.ConfService.php(229): ConfService->getUniquePluginImplInst('LOG_DRIVER', 'log') #2 C:\UniServer\www\domain\secure\core\classes\class.AJXP_Logger.php(89): ConfService::getLogDriverImpl() #3 C:\UniServer\www\domain\secure\core\classes\class.AJXP_Logger.php(69): AJXP_Logger::getInstance() #4 C:\UniServer\www\domain\secure\core\classes\class.AJXP_XMLWriter.php(195): AJXP_Logger::logAction('error', Array) #5 C:\UniServer\www\domain\secure\core\classes\class.AJXP_XMLWriter.php(208): AJXP_XMLWriter::catchError(0, 'Cannot find plu...', 'C:\UniServer\ww...', 164, NULL) #6 [internal function]: AJXP_XMLWriter::catchException(Object(Exception)) #7 {main}
Its propably caused by PHP >= 5.4
I had no error before PHP update.
EDIT: Downgrading back to PHP 5.3 fixed error, so its caused by PHP 5.4
Just had the same problem: caused by write permissions on folders in the "data" directory.
Set the write permissions on the top level directory "data" and all sub directories. I thought I had set the permissions with Filezilla but, after a quick check, I had not.
Concerning the "set locale" notice, you can find detailed explanation with some examples in the PHP documentation: http://php.net/manual/en/function.setlocale.php.
As for the AjaXplorer exception, its documentation states:
you have an FTP access to a remote server running PHP (>5.1) and accessible through the web
I googled the exception and most of the time it's thrown due to wrong PHP version. You can easily check your PHP version with PHP function phpversion():
echo phpversion();
If your PHP version does not match the AjaXplorer's requirement, you have to obviously upgrade PHP or abandon AjaXplorer in favour of another solution.
Just change the permission
chmod -R 777 /etc/zpanel/panel
and the log
tail /etc/httpd/logs/error_log

Categories