Laravel 4 Commands stopped working suddenly - php

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 ?

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

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

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.

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.

Clarity on the use of pragmarx/firewall package for Laravel 5.2

so I've just completed the install of antonioribeiro/firewall package for laravel, which essentially allows blacklisting and whitelist of IP address and countries.
I'm working through the section on Artisan Commands, but when i try to run 'php artisan firewall:whitelist country:za' I get the following error:
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "firewall:whitelist" is not defined.
Did you mean one of these?
firewall:list
firewall:tables
I have done all the necessary installation steps outlined in the documentation.
What am i doing wrong ? should I be using this command elsewhere ?
I am aware that these can be manually entered into the DB, but this functionality would be great to have.
I managed to fix the problem:
SOLUTION: When you run 'php artisan vendor:publish' it creates a new file called 'firewall.php' in the config directory. This is where you set default options. Simply change 'use_database' to true and the Database specific commands will work.
firewall:blacklist
firewall:clear
firewall:remove
firewall:whitelist

Php artisan not working (laravel 5.1)

Suddenly when i type php artisan or any artisan command
i seen this message
[ErrorException]
Trying to get property of non-object
I tried the following
1- php artisan clear-compiled
2- To delete vendor directory and use composer install Or composer update
3- clone a standard Laravel app and put my files app dir and my config
and use composer commands but with step the error has changed to be
[ErrorException]
Trying to get property of non-object
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
Any Suggestions ?
Thanks
If I understand well, you have this issue when you use your app files. It probably means that you have some problem in constructor - you try to run function and the object is not initialized. You should not set up things in constructors (look for example at your controllers) or you will get some "strange" errors and your artisan won't work
After navigation on my app i found the issue in my ServiceProviderClass boot() method in particular when comment one method get data according to subDomain name artisan worked well
Laravel Doc hint for this method
This method is called after all other service providers have been registered, meaning you have access to all other services that have been registered by the framework
for more read Laravel service provider

Categories