Laravel 5 Class Log Could not be Found - php

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.

Related

Laravel 5.6: Uncaught ReflectionException: Class env does not exist

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.

error class not found Slim subfolder

I'm putting my website on server but I have some issues to do so.
Indeed, I made it the simpliest way I know, I only copy-paste my files to my server.
I developed my website in php with Slim. It work perfectly locally, but not on the OVH server (mutualised Pro version).
It throw this error :
Fatal error: Uncaught Error: Class
'App\Middleware\ValidationErrorsMiddleware' not found in
/home/username/www/jobs/bootstrap/app.php:154 Stack trace: #0
/home/username/www/jobs/public/index.php(9): require() #1 {main} thrown
in /home/username/www/jobs/bootstrap/app.php on line 154
I'm not sure, but maybe it's because I placed it in a subfolder.
If somebody have a solution :)
Thank you in advance and sorry for the inconvenience, I'm nearly sure that it's due to a stupid mistake I made.

Laravel: Interface 'Psr\Http\Message\UriInterface' not found

I am facing this error when trying to call a function that connects to an api.
The full error is:
Symfony\Component\Debug\Exception\FatalErrorException: Interface 'Psr\Http\Message\UriInterface' not found in /path/to/project/vendor/guzzlehttp/psr7/src/Uri.php:13
Cannot find much help on forums.
EDIT
Actually this is all the error I get, see this screenshot:
Even in the logs that are generated in /storage/logs, I only get this message:
[2017-06-08 03:03:35] local.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Interface 'Psr\Http\Message\UriInterface' not found in /path/to/project/vendor/guzzlehttp/psr7/src/Uri.php:13
Stack trace:
#0 {main}
Is your composer version up to date? Have you tried composer dump-autoload -o?

Could not find a valid ServiceManager for RoutePluginManager

When I try to run zend program its shows error as follows
PHP Fatal error: Uncaught exception
'Zend\ModuleManager\Listener\Exception\RuntimeException' with message
'Could not find a valid ServiceManager for RoutePluginManager' in
/Documents/zf2-example-login/vendor/zendframework/zend-modulemanager/src/Listener/ServiceListener.php:202
Stack trace:
#0 /Documents/zf2-example-login/vendor/zendframework/zend-eventmanager/src/EventManager.php(271):
Zend\ModuleManager\Listener\ServiceListener-onLoadModulesPost(Object(Zend\ModuleManager\ModuleEvent))
#1 /Documents/zf2-example-login/vendor/zendframework/zend-eventmanager/src/EventManager.php(143):
Zend\EventManager\EventManager-triggerListeners(Object(Zend\ModuleManager\ModuleEvent))
#2 /Documents/zf2-example-login/vendor/zendframework/zend-modulemanager/src/ModuleManager.php(129):
Zend\EventManager\EventManager-triggerEvent(Object(Zend\ModuleManager\ModuleEvent))
#3 /Documents/zf2-example-login/vendor/zendframework/zend-mvc/src/Application.php(264): Zend\ModuleManager\ModuleManager-> in
/Documents/zf2-example-login/vendor/zendframework/zend-modulemanager/src/Listener/ServiceListener.php
on line 202
I'm newbie to zend, I tried googling but unable to find the solution.Help me.
Found a clue here:
https://github.com/zendframework/zend-modulemanager/issues/42
You first need to check to see if you have ZF3 installed. One quick way to check is to look under "vendor/zendframework" and see if you have a subdirectory "zend-router".
If so, add this to your application.config.php file under the "modules" key:
'Zend\Router'

Getting 500 Internal Server Error with Stripe

I am trying to implement basic functionality of the Stripe API, I get 500 Internal Server Error for some reason when I require the Stripe.php file that you have to require...When I comment the require out the error goes away but obviously I can not use the API then..
Basic require...shows error in the Modal Log
require_once('/php/Stripe.php');
I checked the server error and it gave me this back
Fatal error: Uncaught exception 'Exception' with message 'Stripe needs the Multibyte String PHP extension.' in /php/Stripe.php:13 Stack trace: #0 /home/stripepost.php(4): require_once() #1 {main} thrown in /php/Stripe.php on line 13
This all comes from just requiring the file..
Is your 'Stripe.php' file really located in '/php' or is it in a folder called 'php' local to your code?
Current code:
require_once('/php/Stripe.php');
I think the problem is this. You probably mean to use something relative to your code base. Like this:
require_once('./php/Stripe.php');
I found out the answer I didn't have the mbstring enabled on my server...whooops

Categories