Cake PHP 3.4 error when bake a model - php

I've Cake PHP 3.4 application on PHP 5.6.
When I try to bake a mode like this sudo bin/cake bake model my_table it gives below error.
Exception: Plugin WyriHaximus/TwigView could not be found. in [/home/yasith/PROJECTS/GINA/gigstr_backend/vendor/cakephp/cakephp/src/Core/Plugin.php, line 149]
2018-01-13 10:43:17 Error: [Cake\Core\Exception\MissingPluginException] Plugin WyriHaximus/TwigView could not be found. in /home/yasith/PROJECTS/GINA/gigstr_backend/vendor/cakephp/cakephp/src/Core/Plugin.php on line 149
Exception Attributes: array (
'plugin' => 'WyriHaximus/TwigView',
)
Stack Trace:
#0 /home/yasith/PROJECTS/GINA/gigstr_backend/vendor/cakephp/bake/src/Shell/BakeShell.php(58): Cake\Core\Plugin::load('WyriHaximus/Twi...', Array)
#1 /home/yasith/PROJECTS/GINA/gigstr_backend/vendor/cakephp/cakephp/src/Console/Shell.php(497): Bake\Shell\BakeShell->startup()
#2 /home/yasith/PROJECTS/GINA/gigstr_backend/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(230): Cake\Console\Shell->runCommand(Array, true, Array)
#3 /home/yasith/PROJECTS/GINA/gigstr_backend/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(182): Cake\Console\ShellDispatcher->_dispatch(Array)
#4 /home/yasith/PROJECTS/GINA/gigstr_backend/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(128): Cake\Console\ShellDispatcher->dispatch(Array)
#5 /home/yasith/PROJECTS/GINA/gigstr_backend/bin/cake.php(33): Cake\Console\ShellDispatcher::run(Array)
#6 {main}
The bake is working well in previously and that didn't give any error before.
is that any version issue or how to fix that?

Related

Deploy error with Laravel project on Shared Hosting (Uncaught RuntimeException: A facade root has not been set)

I'm deploying a laravel project into production enviroment on a shared host using FTP following this tutorial except the creation of the symbolic link beacuse I'm not using the local storage but ran into "Uncaught RuntimeException: A facade root has not been set" error.
Aditional info:
I tried with a new laravel project with the command composer create-project laravel/laravel project_name 9 and deployed without run it in my computer and got the same error, then I tested it on my computer and worked fine.
The host was configured to follow these route: /web/content, where is displayed the public files. I followed the tutorial routing and created a folder with project's name with all files except the public folder contents as showed in the tutorial but I got the error, so I thought that the structure was giving me the error so I rename the laravel public folder to content and now all files are inside in /web and still getting the error.
Server info: Linux/Apache/PHP-8
Development enviroment: Windows 10/XAMPP/PHP-8.1
For development testing I use php artisan serve rather than XAMPP
I've deployed the project in my personal Heroku and all is working fine, as an additional test, I've deployed the project via XAMPP on my computer following the same structure in the point 2 and works fine.
Checking the logs I got this:
Server Logs
[17-Jul-2022 18:40:36 America/Chicago] PHP Fatal error: Uncaught RuntimeException: A facade root has not been set. in /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:334
Stack trace:
#0 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/RegisterErrorViewPaths.php(18): Illuminate\Support\Facades\Facade::__callStatic('replaceNamespac...', Array)
#1 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(626): Illuminate\Foundation\Exceptions\RegisterErrorViewPaths->__invoke()
#2 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(607): Illuminate\Foundation\Exceptions\Handler->registerErrorViewPaths()
#3 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(538): Illuminate\Foundation\Exceptions\Handler->renderHttpException(Object(Symfony\Component\HttpKernel\Exception\HttpException))
#4 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(444): Illuminate\Foundation\Exceptions\Handler->prepareResponse(Object(Illuminate\Http\Request), Object(Symfony\Component\HttpKernel\Exception\HttpException))
#5 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(363): Illuminate\Foundation\Exceptions\Handler->renderExceptionResponse(Object(Illuminate\Http\Request), Object(ParseError))
#6 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(427): Illuminate\Foundation\Exceptions\Handler->render(Object(Illuminate\Http\Request), Object(ParseError))
#7 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(115): Illuminate\Foundation\Http\Kernel->renderException(Object(Illuminate\Http\Request), Object(ParseError))
#8 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/content/index.php(51): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#9 {main}
thrown in /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 334
Laravel Logs
[2022-07-17 18:40:36] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:207)
[stacktrace]
#0 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(132): Illuminate\\Log\\LogManager->resolve(NULL, NULL)
#1 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(119): Illuminate\\Log\\LogManager->get(NULL)
#2 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(636): Illuminate\\Log\\LogManager->driver()
#3 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(275): Illuminate\\Log\\LogManager->error('syntax error, u...', Array)
#4 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(415): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(ParseError))
#5 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(113): Illuminate\\Foundation\\Http\\Kernel->reportException(Object(ParseError))
#6 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/content/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#7 {main}
"}
[2022-07-17 18:40:36] laravel.ERROR: syntax error, unexpected token ")" {"exception":"[object] (ParseError(code: 0): syntax error, unexpected token \")\" at /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/symfony/finder/Finder.php:588)
[stacktrace]
#0 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/composer/ClassLoader.php(428): Composer\\Autoload\\includeFile('/mnt/stor2-wc1-...')
#1 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(88): Composer\\Autoload\\ClassLoader->loadClass('Symfony\\\\Compone...')
#2 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(65): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->getConfigurationFiles(Object(Illuminate\\Foundation\\Application))
#3 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(39): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->loadConfigurationFiles(Object(Illuminate\\Foundation\\Application), Object(Illuminate\\Config\\Repository))
#4 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(239): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->bootstrap(Object(Illuminate\\Foundation\\Application))
#5 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(153): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#6 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(137): Illuminate\\Foundation\\Http\\Kernel->bootstrap()
#7 /mnt/stor2-wc1-dfw1/406060/2039643domain/web/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#8 /mnt/stor2-wc1-dfw1/406060/2039643/domain/web/content/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#9 {main}
"}
UPDATE
By curiosity, tried with Laravel 8 and all work fine, but with Laravel 9 don't and by project's requirements, I'm not allowed to downgrade the Laravel version.
Well I couldn't manage to solve the problem on Laravel 9, so the solution was to downgrade to Laravel 8, maybe the problem is the configuration on the host server.

When I opened the project,I get back this error message

When I opened the project,I get back this error message :
Fatal error: Uncaught Error: Class 'String' not found in /dev/local/lib/Cake/Utility/Debugger.php:339 Stack trace: #0 /dev/local/lib/Cake/Utility/Debugger.php(741): Debugger::trace(Array) #1 /dev/local/lib/Cake/Error/ErrorHandler.php(219): Debugger->outputError(Array) #2 /dev/local/lib/Cake/Core/App.php(565): ErrorHandler::handleError(2, 'Declaration of ...', '/dev/local...', 25, Array) #3 /dev/local/lib/Cake/Core/App.php(565): include() #4 [internal function]: App::load('TradeLog') #5 [internal function]: spl_autoload_call('TradeLog') #6 /dev/local/lib/Cake/Utility/ClassRegistry.php(145): class_exists('TradeLog') #7 /dev/local/app/Controller/Component/UserComponent.php(61): ClassRegistry::init('TradeLog') #8 /dev/local/app/Controller/Component/PlatformAgentComponent.php(24): UserComponent->__construct(Object(ComponentCollection), Array) #9 /Us in /dev/local/lib/Cake/Utility/Debugger.php on line 339
The newly configured environment in mac os.
When I paste the project into a folder, this error occurs. What's the matter?
This is a compatibility issue between Cakephp 2.4 and PHP7 (because string became reserved word in PHP7, so Cakephp cannot use it as a class name). Using of newer version of Cakephp is suggested. Also downgrading your PHP to 5.6 could solve the problem.
You need to upgrade to CakePHP > 2.8 which is compatible with PHP7
https://github.com/cakephp/cakephp/releases/2.8.0

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

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

Categories