Laravel: PHP artisan Command Stopped Working - laravel

php artisan --version
[Symfony\Component\Debug\Exception\FatalThrowableError]
Fatal error: Call to a member function getArgument() on null
Log files...
[2018-02-01 19:26:51] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Fatal error: Call to a member function getArgument() on null in /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Console/Command.php:216
Stack trace:
#0 /Library/WebServer/vhosts/mysitename/app/Console/Commands/ReportMonthlyMembershipAircraftBreakdown.php(69): Illuminate\Console\Command->argument('email')
#1 [internal function]: App\Console\Commands\ReportMonthlyMembershipAircraftBreakdown->__construct()
#2 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Container/Container.php(783): ReflectionClass->newInstanceArgs(Array)
#3 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Container\Container->build('App\\Console\\Com...', Array)
#4 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(697): Illuminate\Container\Container->make('App\\Console\\Com...', Array)
#5 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Console/Application.php(115): Illuminate\Foundation\Application->make('App\\Console\\Com...')
#6 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Console/Application.php(129): Illuminate\Console\Application->resolve('App\\Console\\Com...')
#7 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(237): Illuminate\Console\Application->resolveCommands(Array)
#8 /Library/WebServer/vhosts/mysitename/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Illuminate\Foundation\Console\Kernel->getArtisan()
#9 /Library/WebServer/vhosts/mysitename/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 {main}
I have deleted my entire vendor folder and tried to reinstate it, and it always gets to here and blows up with the same error.
Generating autoload files
> php artisan clear-compiled
[Symfony\Component\Debug\Exception\FatalThrowableError]
Fatal error: Call to a member function getArgument() on null
Here is my version pulled from the file, since I can't run an artisan --version to get it for you.
/**
* The Laravel framework version.
*
* #var string
*/
const VERSION = '5.2.32';
Just looking for any help you can give me. This has happened on both my local copy and the site copy

The problem came from having the command
$this->argument in the contructor and not in the handle method.
I just never expected that a console file would stop php artisan --version from stopping to work because of a command file that was not going to be run yet.
Thanks btl for getting me on the right direction.

You have an error in your code somewhere most likely which is giving you this error. Do a global search on getArgument() and see where it can be coming from.
[internal function]: App\Console\Commands\ReportMonthlyMembershipAircraftBreakdown

Related

Laravell, artisan error Class "App\Console\Kernel" does not exist

I have install fresh version of laravel and put inside my script, after that I want to run migrations but there is an error from artisan that class Kernel does not exist when oryginal file in /app/console/Kernel.php exist
error:
php artisan
PHP Fatal error: Uncaught ReflectionException: Class "App\Console\Kernel" does not exist in /home/john/domains/mydomain.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:875
Stack trace:
#0 /home/john/domains/mydomain.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(875): ReflectionClass->__construct()
(...)
#8 /home/john/domains/mydomain.com/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(845): Illuminate\Container\Container->make()
#9 /home/john/domains/mydomain.com/artisan(33): Illuminate\Foundation\Application->make()
#10 {main}
Next Illuminate\Contracts\Container\BindingResolutionException: Target class [App\Console\Kernel] does not exist. in /home/john/domains/mydomain.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:877
Stack trace:
#0 /home/john/domains/mydomain.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(756): Illuminate\Container\Container->build()
(...)
#8 /home/john/domains/mydomain.com/artisan(33): Illuminate\Foundation\Application->make()
#9 {main}
thrown in /home/john/domains/mydomain.com/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 877
I have check if Kernel file exist, trying to remove vendor folder and composer install but problem still exist

Why do I get an error in laravel 8 log but not in browser

I normally duplicate a project to start a new one. In the browser, there is no error. The page displays properly. In Laravel log I get the following error, although the file fn_table.php is there. If I remove the file, I get an error in the browser.
[2021-08-27 09:55:45] local.ERROR: include_once(public/fn/fn_table.php): Failed to open stream: No such file or directory {"exception":"[object] (ErrorException(code: 0): include_once(public/fn/fn_table.php): Failed to open stream: No such file or directory at /Users/paul/WebSites/MeerkatSafaris/app/Providers/AppServiceProvider.php:12)
[stacktrace]
#0 /Users/paul/WebSites/MeerkatSafaris/app/Providers/AppServiceProvider.php(12): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'include_once(pu...', '/Users/paul/Web...', 12)
#1 /Users/paul/WebSites/MeerkatSafaris/app/Providers/AppServiceProvider.php(12): include_once()
#2 /Users/paul/WebSites/MeerkatSafaris/vendor/composer/ClassLoader.php(480): include('/Users/paul/Web...')
#3 /Users/paul/WebSites/MeerkatSafaris/vendor/composer/ClassLoader.php(346): Composer\\Autoload\\includeFile('/Users/paul/Web...')
#4 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(735): Composer\\Autoload\\ClassLoader->loadClass('App\\\\Providers\\\\A...')
#5 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(669): Illuminate\\Foundation\\Application->resolveProvider('App\\\\Providers\\\\A...')
#6 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(75): Illuminate\\Foundation\\Application->register('App\\\\Providers\\\\A...')
#7 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(649): Illuminate\\Foundation\\ProviderRepository->load(Array)
#8 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\\Foundation\\Application->registerConfiguredProviders()
#9 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(237): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#10 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#11 /Users/paul/WebSites/MeerkatSafaris/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#12 Command line code(1): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#13 {main}
What is happening?
In fact these errors are all over my project.
I learned how to create a file with global functions by listing their path in the autoload varibale in the composer.json. This is ok for functions used all over the project.
However, it happens that I need some global functions only in some controllers. I normally use php include_once which works 100% but generates the above error in the log.
What is the way around that?
And why is the laravel log reports an error on a file which is there?

Laravel: symlink(): Permission denied on centos how to fix?

I am installing a project made in laravel on a server with a CENTOS 7.9 vmware [cpnael] v94.0.8 operating system, modify the permissions I needed to operate the project.
When I run the project I get the present error:
[2021-05-10 16:26:39] production.ERROR: symlink(): Permission denied {"exception":"[object] (ErrorException(code: 0): symlink(): Permission denied at /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:315)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'symlink(): Perm...', '/home/cbdev/pub...', 315, Array)
#1 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(315): symlink('/home/cbdev/pub...', '/home/cbdev/pub...')
#2 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php(45): Illuminate\\Filesystem\\Filesystem->link('/home/cbdev/pub...', '/home/cbdev/pub...')
#3 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Foundation\\Console\\StorageLinkCommand->handle()
#4 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#5 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#6 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#7 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Container/Container.php(611): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#8 /home/cbdev/public_html/crater/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call(Array)
How can I solve this problem?
use this command php artisan storage:link
If php artisan storage:link does not help, it can happen that your hosting does not allow you to make symlinks with a command.
Try to contact the support of your hosting if this is the case, or try to make the symlink manually using midnight commander (use the command mc in the ssh of the webserver then create the symlink between public storage and storage/app/public) ,
or with the ln linux command (https://linuxize.com/post/how-to-create-symbolic-links-in-linux-using-the-ln-command/).

PHP Fatal error: Uncaught Error: Call to undefined function simplexml_load_string() in public_html/lib/Varien/Simplexml/Config.php:510

I'm getting this error. Can you please help me understand why it is coming and what does it mean. I did not change any code. It is running on PHP 7.1 and Operating system is Linux.
PHP Warning: PHP Startup: SourceGuardian: Unable to initialize module
Module compiled with module API=20160303
PHP compiled with module API=20170718
These options need to match in Unknown on line 0
PHP Fatal error: Uncaught Error: Call to undefined function
simplexml_load_string() in public_html/lib/Varien/Simplexml/Config.php:510
Stack trace:
#0 /home3/ramesqj3/public_html/lib/Varien/Simplexml/Config.php(498):
Varien_Simplexml_Config->loadString('<?xml version="...',
'Mage_Core_Model...')
#1/home3/ramesqj3/public_html/app/code/core/Mage/Core/Model/Config.php(277):
Varien_Simplexml_Config->loadFile('/home3/ramesqj3...')
#2 /home3/ramesqj3/public_html/app/code/core/Mage/Core/Model/App.php(391):
Mage_Core_Model_Config->loadBase()
#3 /home3/ramesqj3/public_html/app/code/core/Mage/Core/Model/App.php(304):
Mage_Core_Model_App->_initBaseConfig()
#4 /home3/ramesqj3/public_html/app/code/core/Mage/Core/Model/App.php(348):
Mage_Core_Model_App->baseInit(Array)
#5 /home3/ramesqj3/public_html/app/Mage.php(686): Mage_Core_Model_App-
>run(Array)
#6 /home3/ramesqj3/public_html/index.php(83): Mage::run('', 'store')
#7 {main}
thrown in public_html/lib/Varien/Simplexml/Config.php on line 510

Whoops, looks like something went wrong. Laravel 5.1

I have a route like this
http://localhost/inspection/show/{id}
When I try to load the route at the same time. In different tabs, sometimes some of those tabs has the error "Whoops, looks like something went wrong"
Loading in different tabs so fast
http://localhost/inspection/show/8
http://localhost/inspection/show/9
http://localhost/inspection/show/10
http://localhost/inspection/show/11
The stack trace have this
[2015-08-06 14:57:53] local.ERROR: exception 'RuntimeException' with message 'No supported encrypter found. The cipher and / or key length are invalid.' in C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php:29
Stack trace:
#0 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(733): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}(Object(Illuminate\Foundation\Application), Array)
#1 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(626): Illuminate\Container\Container->build(Object(Closure), Array)
#2 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(674): Illuminate\Container\Container->make('encrypter', Array)
#3 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(837): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#4 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(800): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#5 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(771): Illuminate\Container\Container->getDependencies(Array, Array)
#6 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(626): Illuminate\Container\Container->build('IAServer\\Http\\M...', Array)
#7 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(674): Illuminate\Container\Container->make('IAServer\\Http\\M...', Array)
#8 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(143): Illuminate\Foundation\Application->make('IAServer\\Http\\M...')
#9 C:\wamp\www\iaserver\public\index.php(58): Illuminate\Foundation\Http\Kernel->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response))
#10 {main}
The .env file is correct, i re-run php artisan key:generate
APP_ENV=local
APP_DEBUG=true
APP_KEY=UC5Fsvi8JsGG4U72k04rS3o5csiINDYB
But the error still appears only when the route is quickly loaded with different id.
Why?
I solved, sometimes laravel not read APP_KEY in .ENV. And returns a value "SomeRandomString" (default is defined in config / app.php), and have the error "key length is invalid", so the solution is to copy the value of APP_KEY, to the value 'key 'in config / app.php, that's all! I solved!
You may try to run php artisan key:generate again, this should solve the problem.

Resources