Laravel 5.2: Class log does not exist in /vendor/laravel/framework/src/Illuminate/Container/Container.php:734 - php

I had to clear config and cache, I ran into the following exception :
PHP Fatal error: Uncaught ReflectionException: Class log does not exist in /html/project/bootstrap/cache/compiled.php:1355
I removed bootstrap/compiled.php and ran php artisan clear-compiled, Then the exception got changed a little bit.
Class log does not exist in /html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php:734
Steps i took to solve it :
Checked env for spaces and syntax errors, Which had a blank space and i removed it, but still my php artisan commands are not working.
Ran composer update | Still not working
Some people associate the error with mbstring and php-mysql extensions which i both have.
Tried composer dumpautoload
What am i missing, How should be done ?

I think somewhere in your code there is a typo like this (note lowercase 'l'):
\log::info('test');
And that code is executed when artisan is executed, so, probably this is somewhere in your console commands, or maybe in some services used by console commands, or maybe some global configuration.
Anyhow, search for '\log::' or 'log::' (in top-level file without namespaces this would result in same error message), and you'll find it.

Related

trying to run php artisan tinker returns error "file_exists(): Unable to find the wrapper "hoa" "

I'm trying to open tinker in a Laravel project, but when I run php artisan tinker I get this error:
ErrorException
file_exists(): Unable to find the wrapper "hoa" - did you forget to enable it when you configured PHP?
I can't find everything similar error online, I found only similar errors but with 'wrapper http' .
Does anyone have any suggestions? Thanks
Could this be due to custom code or a library you've imported?
I often find that if I add things to the ServiceProvider or Kernel, they run before many of the artisan commands, and if I've failed to perform the proper "if" checks first, it fails.
I suppose the question I would have in return would be; Is this a fresh Laravel install or have you got custom code and libraries running? I would check there, try removing libraries you've added, HOA from my searching doesn't appear to default to Laravel.
— Happy to revise my answer should more detail be provided
Solved with this command founded on github:
composer require psy/psysh:0.11.2 --dev

Symfony messenger can't consume messages

Few weeks ago I set up a Message system with Symfony Messenger and it worked great.
Today I wanted to create new object through message, so I went to my server and type the command to consume message
First I had this result
$ bin/console messenger:consume-messages amqp_notifications
/usr/bin/env: ‘php\r’: No such file or directory
It never happened before with my files, and I never changed the line ending or encoding of my file sin PHPstorm.
I tried to use $ php bin/console messenger:consume-messages amqp_notifications
but then I had this error.
Attempted to load class "AMQPConnection" from the global namespace.
Did you forget a "use" statement?
Pretty weird, because I have have the php-amqp ext installed as you can see on the screenshot of my phpinfo
I didn't change anything in my Message class or Handler.
Also, I tried to call new AMQPConnection() on a random action, just to try, and I didn't get the error.
I'm completely lost with this error this time, as everything is installed.
I use PHP 7.3.1 and symfony Messenger 4.2.2
It seems your second issue was already solved by ccKep on his comment.
The first one is that the specific shebang line #!/usr/bin/env php executes the first php found in the $PATH. So if you already have uninstalled it, which seems the case, or it has a symbolic link to another php version, you can get a wrong result.
Tries to check what is inside the $PATH and replace the PHP path for the correct one. You might get the place running which php.

Laravel - issue with compiled.php

I am relatively new to Laravel, but not PHP. I am trying to get it to work on AppEngine but I am having some difficulties. I have gone through a lot of the errors and fixed them but I can't seem to get around this error:
Call to undefined method Illuminate\Support\Facades\Log::getMonolog()
When I did check the class it said was missing the function it turned out to be correct. I went searching online to see if I could find the getMonolog function to no avail. Does any one have any code that pertains to this function?
Also it seems that my compiled.php file keeps producing these issues. I have tried:
composer update
This produces the following error:
Script php artisan clear-compiled handling the post-update-cmd event returned with an error
[Runtime Exception]
Error Output:
I also ran:
php artisan update
That produced no output what so ever. I think there might be an issue with my artisan class as even php artisan --version produces no output. Any ideas on how to proceed with this issue?

Laravel 4 Commands stopped working suddenly

Back from vacation, and when I'm trying to run one of my previously working command:
php artisan list
Throws me:
[root#api2]# php artisan list
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Call to a member function getArgument() on a non-object","file":"\/var\/www\/html\/api2.alariscms.com\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Command.php","line":153}}
And I seriously cannot understand why this happens. I tried debugging the file that throws an error. It awaits argument:
InputInterface $input but it gets NULL
I don't know what can go wrong on a framework level to stop receiving the required object.
Any ideas where to start debugging from? Or I can reload configurations / update laravel via cmd?
Thanks
This is what I would do:
php artisan dump
composer dump-autoload
check for current Laravel version
and then go to that specific command and check for bug there.
Also, what kind of argument are you trying to pass to command ? Is that object - if so check where is implementation of that class ?

PHPUnit failed opening required file

I've browsed through similar problems on SO, but to no avail. I'm running PHP 5.3.6 and phpunit version 3.6.10. When attempting to execute a simple test:
require_once 'PHPUnit/Framework.php';
class UserTest extends PHPUnit_Framework_TestCase {
}
I receive the following error:
PHP Fatal error: require_once(): Failed opening required 'PHPUnit/Framework.php'
(include_path='.:/Users/username/pear/share/pear:/usr/lib/php/pear/:/Users/username/pear/share/pear/PHPUnit') in ...
When reinstalling PHPUnit, I'm not sure if the install location was duplicated, but it appears that when running which phpunit, the path is: /usr/bin/phpunit. However, it appears to also be installed in /Users/user/pear/bin/phpunit.
I've tried updating all channels and reinstalling PEAR and PHPUnit, but the problem still exists. I'm running on OSX Lion. Any help would be greatly appreciated.
Just remove the line
require_once 'PHPUnit/Framework.php';
and everything should work.
You don't need to include/require anything PHPUnit related since (at least) PHPUnit 3.6 any more and you can't include that file because it doesn't exist any more in the distribution.
The phpunit runner will take care of bootstrapping everything that is needed by PHPUnit :)
As others pointed out, Framework.php is not required anymore.
But in any case if you already have too many test files written and having the include statement, then fixing them going to be a cumbersome task. Which was the case I had to face.
If a quick workaround is needed, create an empty Framework.php file. That will resolve the problem.
Create an empty file named Framework.php under your PHPUnit directory. (eg: at: /usr/share/php/PHPUnit/Framework.php).
sudo touch /usr/share/php/PHPUnit/Framework.php

Categories