cannot execute php artisan command [php fatal error[ - php

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

Related

TYPO3 v9.5: installation error Uncaught RuntimeException

I have unzipped the installation folder. When going to the install.php to start the installer I get an Fatal error: Uncaught RuntimeException.
I use XAMPP with PHP 7.2 and I go to:
http://localhost/typo3/install.php
I get following message:
Fatal error: Uncaught RuntimeException: Could not create directory "/Applications/XAMPP/xamppfiles/htdocs/typo3temp/var/log/"! in /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Utility/GeneralUtility.php:2172 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Utility/GeneralUtility.php(2140): TYPO3\CMS\Core\Utility\GeneralUtility::createDirectoryPath('/Applications/X...') #1 /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Log/Writer/FileWriter.php(222): TYPO3\CMS\Core\Utility\GeneralUtility::mkdir_deep('/Applications/X...') #2 /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Log/Writer/FileWriter.php(193): TYPO3\CMS\Core\Log\Writer\FileWriter->createLogFile() #3 /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Log/Writer/FileWriter.php(123): TYPO3\CMS\Core\Log\Writer\FileWriter->openLogFile() #4 /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Log/Writer/Fil in /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 2172
Stacktrace in log file:
Stack trace:
#0 /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Utility/GeneralUtility.php(2140): TYPO3\CMS\Core\Utility\GeneralUtility::createDirectoryPath('/Applications/X...')
#1 /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Log/Writer/FileWriter.php(222): TYPO3\CMS\Core\Utility\GeneralUtility::mkdir_deep('/Applications/X...')
#2 /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Log/Writer/FileWriter.php(193): TYPO3\CMS\Core\Log\Writer\FileWriter->createLogFile()
#3 /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Log/Writer/FileWriter.php(123): TYPO3\CMS\Core\Log\Writer\FileWriter->openLogFile()
#4 /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Log/Writer/Fil in /Applications/XAMPP/xamppfiles/htdocs/typo3_src/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 2172
:
No more error logs available..
The error means that php cannot write to your xampp htdocs directory, because of security restrictions of the Applications dir.
You should change your xampp configuration like in this tutorial https://pureinfotech.com/install-xampp-windows-10/

Invalid Parameter – yii\base\InvalidParamException The file or directory to be published does not exist: /frontend/web

Moved the site from one server to another with postgresql database. Db has been connected. Then I used this command:
composer install
While loading the site, yii debugger shows an error
What is more, composer update shows many errors in console:
PHP Fatal error: Uncaught Error: Call to undefined method Composer\Package\RootPackage::getConfig() in /var/www/907-irbis/data/www/site.ru/vendor/fxp/composer-asset-plugin/Config/ConfigBuilder.php:111
Stack trace:
#0 /var/www/907-irbis/data/www/site.ru/vendor/fxp/composer-asset-plugin/Config/ConfigBuilder.php(74): Fxp\Composer\AssetPlugin\Config\ConfigBuilder::getConfigBase(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#1 /var/www/907-irbis/data/www/site.ru/vendor/fxp/composer-asset-plugin/FxpAssetPlugin.php(82): Fxp\Composer\AssetPlugin\Config\ConfigBuilder::build(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#2 /usr/share/php/Composer/Plugin/PluginManager.php(215): Fxp\Composer\AssetPlugin\FxpAssetPlugin->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#3 /usr/share/php/Composer/Plugin/PluginManager.php(188): Composer\Plugin\PluginManager->addPlugin(Object(Fxp\Composer\AssetPlugin\FxpAssetPlugin))
#4 /usr/share/php/Composer/Installer/PluginInstaller.php(62): Composer\Pl in /var/www/907-irbis/data/www/site.ru/vendor/fxp/composer-asset-plugin/Config/ConfigBuilder.php on line 111
Fatal error: Uncaught Error: Call to undefined method Composer\Package\RootPackage::getConfig() in /var/www/907-irbis/data/www/site.ru/vendor/fxp/composer-asset-plugin/Config/ConfigBuilder.php:111
Stack trace:
#0 /var/www/907-irbis/data/www/site.ru/vendor/fxp/composer-asset-plugin/Config/ConfigBuilder.php(74): Fxp\Composer\AssetPlugin\Config\ConfigBuilder::getConfigBase(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#1 /var/www/907-irbis/data/www/site.ru/vendor/fxp/composer-asset-plugin/FxpAssetPlugin.php(82): Fxp\Composer\AssetPlugin\Config\ConfigBuilder::build(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#2 /usr/share/php/Composer/Plugin/PluginManager.php(215): Fxp\Composer\AssetPlugin\FxpAssetPlugin->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#3 /usr/share/php/Composer/Plugin/PluginManager.php(188): Composer\Plugin\PluginManager->addPlugin(Object(Fxp\Composer\AssetPlugin\FxpAssetPlugin))
#4 /usr/share/php/Composer/Installer/PluginInstaller.php(62): Composer\Pl in /var/www/907-irbis/data/www/site.ru/vendor/fxp/composer-asset-plugin/Config/ConfigBuilder.php on line 111

PHP Artisan Tinker not working with Laravel 5.4 and PHP 7.0.1

I just added tinker to my Laravel project 5.4.
When I try to run:
php artisan tinker
I am getting following error:
PHP Warning: Uncaught ErrorException: require(/home/abdullah/php_apps/website): failed to open stream: Success in /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php:51
Stack trace:
#0 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php(51): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'require(/home/a...', '/home/abdullah/...', 51, Array)
#1 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php(51): require()
#2 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php(33): Laravel\Tinker\ClassAliasAutoloader->__construct(Object(Psy\Shell), '/home/abdullah/...')
#3 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/Console/TinkerCommand.php(59): Laravel\Tinker\ClassAliasAutoloader::register(Object(Psy\Shell), '/home/abdullah/...')
#4 [internal function]: Laravel\Tinker\Console\TinkerCommand->handle()
#5 /home/abdullah/php_apps/website/vendor/laravel/framework/src/Illuminate/Contai in /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php on line 51
PHP Fatal error: Laravel\Tinker\ClassAliasAutoloader::__construct(): Failed opening required '/home/abdullah/php_apps/website' (include_path='.:/home/abdullah/.phpbrew/php/php-7.0.1/lib/php') in /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php on line 51
[Symfony\Component\Debug\Exception\FatalErrorException]
Laravel\Tinker\ClassAliasAutoloader::__construct(): Failed opening required '/home/abdullah/php_apps/website' (include_path='.:/home/abdullah/.phpbrew/php/php-7.0.1/lib/php')
I have tried giving rights to various folders.
Also tried adding the Tinker class to console/kernel.php.
I fixed it finally by upgrading my version of laravel.
Laravel v5.4.0 to Laravel v5.4.33.

Error in Laravel Artisan command

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

Laravel 5.1 Composer install error

When running composer install I get the following error:
php artisan clear-compiled
PHP Fatal error: Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of Error given, called in /home/vagrant/Code/courtesy-sys/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 73 and defined in /home/vagrant/Code/courtesy-sys/app/Exceptions/Handler.php:25
Stack trace:
#0 /home/vagrant/Code/courtesy-sys/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(73): App\Exceptions\Handler->report(Object(Error))
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Error))
#2 {main}
thrown in /home/vagrant/Code/courtesy-sys/app/Exceptions/Handler.php on line 25
[Symfony\Component\Debug\Exception\FatalErrorException]
Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of Error given, called in /home/vagrant/Code/courtesy-sys/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 73 and defined in /home/vagrant/Code/courtesy-sys/app/Exceptions/Handler.php:25
Stack trace:
#0 /home/vagrant/Code/courtesy-sys/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(73): App\Exceptions\Handler->report(Object(Error))
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Error))
#2 {main}
thrown
Script php artisan clear-compiled handling the post-install-cmd event returned with error code 255
Is there someone with a similar problem and can provide me with the solution. I tried Google without any results...
Try it:
composer install --no-scripts

Categories