Error in Laravel Artisan command - php

I am new in Laravel. I am using Laravel 5.3.I used below code to install Laravel 5.3.
php composer.phar create-project laravel/laravel=5.3 addbook dev-develop
I tried to executed "php artsisan --v" but I found below error
PHP Fatal error: Uncaught ErrorException: array_merge(): Argument #1 is not an
array in D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundati
on\Exceptions\Handler.php:93
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handle
Error(2, 'array_merge(): ...', 'D:\\php7\\htdocs\\...', 93, Array)
#1 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Exc
eptions\Handler.php(93): array_merge(Array)
#2 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Exc
eptions\Handler.php(61): Illuminate\Foundation\Exceptions\Handler->shouldntRepor
t(Object(ErrorException))
#3 D:\php7\htdocs\addbook\app\Exceptions\Handler.php(35): Illuminate\Foundation\
Exceptions\Handler->report(Object(ErrorException))
#4 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Boo
tstrap\HandleExceptions.php(79): App\Exceptions\Handler->report(Object(ErrorExce
ption))
#5 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handle
Exce in D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundatio
n\Exceptions\Handler.php on line 93
PHP Fatal error: Uncaught ErrorException: array_merge(): Argument #1 is not an
array in D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundati
on\Exceptions\Handler.php:93
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handle
Error(2, 'array_merge(): ...', 'D:\\php7\\htdocs\\...', 93, Array)
#1 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Exc
eptions\Handler.php(93): array_merge(Array)
#2 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Exc
eptions\Handler.php(61): Illuminate\Foundation\Exceptions\Handler->shouldntRepor
t(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#3 D:\php7\htdocs\addbook\app\Exceptions\Handler.php(35): Illuminate\Foundation\
Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalErrorEx
ception))
#4 D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate\Foundation\Boo
tstrap\HandleExceptions.php(79): App\Exceptions\Handler->report(Object(Symfony\C
omponent\Debug in D:\php7\htdocs\addbook\vendor\laravel\framework\src\Illuminate
\Foundation\Exceptions\Handler.php on line 93
Can anyone say what is the solution ??

Well, don't use the develop branch!
Run php composer.phar create-project --prefer-dist laravel/laravel=5.3 addbook.
Also, if your Composer Vendor folder is your path, you should be able to achieve the same by running
laravel new addbook

You need pull stability version, try add param --prefer-dist
composer create-project --prefer-dist laravel/laravel addbook

Related

Function name must be a string (symfony/flex) afer composer require but not update

Installing some bundles in symfony 4 when I execute the command I get the same error over and over:
Command:
composer require phpoffice/phpspreadsheet secit-pl/imap-bundle tbbc/money-bundle
Erro with stack trace
PHP Fatal error: Uncaught Error: Function name must be a string in /var/www/skeleton/vendor/symfony/flex/src/ParallelDownloader.php:246
Stack trace:
#0 /var/www/skeleton/vendor/symfony/flex/src/ParallelDownloader.php(84): Symfony\Flex\ParallelDownloader->getNext()
#1 phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php(195) : eval()'d code(452): Symfony\Flex\ParallelDownloader->download(Array, Object(Closure))
#2 [internal function]: Symfony\Flex\Flex_composer_tmp1->populateProvidersCacheDir(Object(Composer\Installer\InstallerEvent))
#3 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(176): call_user_func(Array, Object(Composer\Installer\InstallerEvent))
#4 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(135): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Installer\InstallerEvent))
#5 phar:///usr/local/bin/composer/src/Composer/Installer.php(471): Composer\EventDispatcher\EventDispatcher- in /var/www/skeleton/vendor/symfony/flex/src/ParallelDownloader.php on line 246
Fatal error: Uncaught Error: Function name must be a string in /var/www/skeleton/vendor/symfony/flex/src/ParallelDownloader.php:246
Stack trace:
#0 /var/www/skeleton/vendor/symfony/flex/src/ParallelDownloader.php(84): Symfony\Flex\ParallelDownloader->getNext()
#1 phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php(195) : eval()'d code(452): Symfony\Flex\ParallelDownloader->download(Array, Object(Closure))
#2 [internal function]: Symfony\Flex\Flex_composer_tmp1->populateProvidersCacheDir(Object(Composer\Installer\InstallerEvent))
#3 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(176): call_user_func(Array, Object(Composer\Installer\InstallerEvent))
#4 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(135): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Installer\InstallerEvent))
#5 phar:///usr/local/bin/composer/src/Composer/Installer.php(471): Composer\EventDispatcher\EventDispatcher- in /var/www/skeleton/vendor/symfony/flex/src/ParallelDownloader.php on line 246
Environment
OS: Ubuntu 16.04
PHP: 7.2.5
That only happens when I use composer require I just did an update and updated some packages included the ones which flex didn't install but didn't throw any error
Is this a bug?
It is a recent bug raised in Flex 1.0.81, upgrade to 1.0.82 (which is the same as 1.0.80) as a hotfix.
Ref: https://github.com/symfony/flex/issues/381

Setup a Laravel existing project

I'm trying to install an existing Laravel project by running a "composer install" command but i'm getting the following errors :
PHP Fatal error: Uncaught Error: Class 'Symfony\Thanks\Command\ThanksCommand' not found in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php:58
Stack trace:
#0 /usr/share/php/Composer/Plugin/PluginManager.php(236): Symfony\Thanks\Thanks->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#1 /usr/share/php/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin(Object(Symfony\Thanks\Thanks))
#2 /usr/share/php/Composer/Plugin/PluginManager.php(261): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage))
#3 /usr/share/php/Composer/Plugin/PluginManager.php(76): Composer\Plugin\PluginManager->loadRepository(Object(Composer\Repository\InstalledFilesystemRepository))
#4 /usr/share/php/Composer/Factory.php(384): Composer\Plugin\PluginManager->loadInstalledPlugins()
#5 /usr/share/php/Composer/Factory.php(576): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, false)
#6 /usr/share/php/Composer/Console/Application.php(332): C in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php on line 58
Fatal error: Uncaught Error: Class 'Symfony\Thanks\Command\ThanksCommand' not found in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php:58
Stack trace:
#0 /usr/share/php/Composer/Plugin/PluginManager.php(236): Symfony\Thanks\Thanks->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#1 /usr/share/php/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin(Object(Symfony\Thanks\Thanks))
#2 /usr/share/php/Composer/Plugin/PluginManager.php(261): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage))
#3 /usr/share/php/Composer/Plugin/PluginManager.php(76): Composer\Plugin\PluginManager->loadRepository(Object(Composer\Repository\InstalledFilesystemRepository))
#4 /usr/share/php/Composer/Factory.php(384): Composer\Plugin\PluginManager->loadInstalledPlugins()
#5 /usr/share/php/Composer/Factory.php(576): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, false)
#6 /usr/share/php/Composer/Console/Application.php(332): C in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php on line 58
Can anyone help me, I am really overwhelmed
Just delete vendor folder and than run composer update command
Try using composer update and composer dump-autoload command
When you run composer install it will look for a lock file and install whatever is contained in it. Check if your composer.lock or run composer update command
Try the following steps:
Remove the vendor folder if already there
Delete the composer.lock file
Run composer install command in the terminal.

cannot execute php artisan command [php fatal error[

I have a laravel project I installed the composer
and run
composer install
After that I executed the update command
composer update
on the project's root directory, and during the execution on the command
php artisan optimize
I got the error shown in the attached image.
When I try to execute any php artisan command I got the same error too.
Error lines
PHP Fatal error: Uncaught Error: Call to undefined method Illuminate\Support\Facades\Auth::check() in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:221
Stack trace:
#0 C:\xampp\htdocs\projectx\app\Exceptions\Handler.php(39): Illuminate\Support\Facades\Facade::__callStatic('check', Array)
#1 C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(81): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 {main}
thrown in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 221
PHP Fatal error: Uncaught Error: Call to undefined method Illuminate\Support\Facades\Auth::check() in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:221
Stack trace:
#0 C:\xampp\htdocs\projectx\app\Exceptions\Handler.php(39): Illuminate\Support\Facades\Facade::__callStatic('check', Array)
#1 C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(81): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#2 C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(123): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#3 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#4 {main}
thrown in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 221
You could try to use the append_config() helper method in your environment app configuration file:
'providers' => append_config(array(
'LocalOnlyServiceProvider',
))
The command php artisan optimize has been remove in laravel 5.6
see more: https://laravel.com/docs/5.6/upgrade

CakePHP and Memcached error - php5.6

I'm trying to migrate our company application from php 5.3 to php 5.6. This app uses cakephp 2.4.3 and memcached, but when I try to execute ./cake bake command, the next error comes up:
Fatal error: Uncaught exception 'CacheException' with message 'Cache engine _cake_core_ is not properly configured.' in /cluster/data/deploy/clickdelivery/current/lib/Cake/Cache/Cache.php:181
Stack trace:
#0 /cluster/data/deploy/clickdelivery/current/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_')
#1 /cluster/data/deploy/clickdelivery/current/app/Config/core.php(381): Cache::config('_cake_core_', Array)
#2 /cluster/data/deploy/clickdelivery/current/lib/Cake/Core/Configure.php(72): include('/cluster/data/d...')
#3 /cluster/data/deploy/clickdelivery/current/lib/Cake/bootstrap.php(177): Configure::bootstrap(true)
#4 /cluster/data/deploy/clickdelivery/current/lib/Cake/Console/ShellDispatcher.php(136): require('/cluster/data/d...')
#5 /cluster/data/deploy/clickdelivery/current/lib/Cake/Console/ShellDispatcher.php(98): ShellDispatcher->_bootstrap()
#6 /cluster/data/deploy/clickdelivery/current/lib/Cake/Console/ShellDispatcher.php(54): ShellDispatcher->_initEnvironment()
#7 /cluster/data/deploy/clickdelivery/cu in /cluster/data/deploy/clickdelivery/current/lib/Cake/Cache/Cache.php on line 181
Persistent and models directory are created with +W.
Thanks in advance.

Laravel and Lumen ACL with Shared Codebase

I have two separate projects:
Admin (Laravel 5.4)
API (Lumen 5.4)
with Shared Codebase (database, models...)
In my Admin project I use spatie/laravel-permission, but this package is not available for Lumen i.e. When I try to install package in my Lumen project (API) I got this error:
Fatal error: Uncaught ReflectionException: Class path.storage does not exist in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:681 Stack trace: #0 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(681): ReflectionClass->__construct('path.storage') #1 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(565): Illuminate\Container\Container->build('path.storage') #2 /var/www/html/vendor/laravel/lumen-framework/src/Application.php(208): Illuminate\Container\Container->make('path.storage') #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(105): Laravel\Lumen\Application->make('path.storage') #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(800): app('path.storage') #5 /var/www/html/vendor/laravel/lumen-framework/config/view.php(31): storage_path('framework/views') #6 /var/www/html/vendor/laravel/lumen-framework/src/Application.php(575): require('/var/www/html/v...') #7 /var/www/html/ in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 681
Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalErrorException: Uncaught ReflectionException: Class path.storage does not exist in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:681 Stack trace: #0 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(681): ReflectionClass->__construct('path.storage') #1 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(565): Illuminate\Container\Container->build('path.storage') #2 /var/www/html/vendor/laravel/lumen-framework/src/Application.php(208): Illuminate\Container\Container->make('path.storage') #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(105): Laravel\Lumen\Application->make('path.storage') #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(800): app('path.storage') #5 /var/www/html/vendor/laravel/lumen-framework/config/view.php(31): storage_path('framework/views') #6 /var/www/html/vendor/laravel/lumen-framework/src/Appli in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 681
Where is the problem? Can I use this package in Lumen?
Or could you suggest me some other package for Role & Permission work in Laravel and Lumen.
I saw that spatie/laravel-permission repository does not support Lumen
try to see if this may be for you
http://www.laraveldoctrine.org/docs/1.2/acl

Categories