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

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

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.

Target [Illuminate\Contracts\Auth\Access\Gate] is not instantiable

I'm upgrading Laravel from 5.2 to 5.3
I followed the steps mentioned here:
https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0
When I tried to to do composer update I kept getting:
[2021-04-12 06:15:52] build.ERROR: exception 'Illuminate\Contracts\Container\BindingResolutionException' with message 'Target [Illuminate\Contracts\Auth\Access\Gate] is not instantiable.' in XXXXXXXXXXXX/admin/vendor/laravel/framework/src/Illuminate/Container/Container.php:763
#0 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Container/Container.php(644): Illuminate\Container\Container->build('Illuminate\\Cont...', Array)
#1 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(709): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
#2 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Container/Container.php(1203): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#3 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(175): Illuminate\Container\Container->offsetGet('Illuminate\\Cont...')
#4 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(144): Illuminate\Support\Facades\Facade::resolveFacadeInstance('Illuminate\\Cont...')
#5 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(231): Illuminate\Support\Facades\Facade::getFacadeRoot()
#6 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php(25): Illuminate\Support\Facades\Facade::__callStatic('policy', Array)
#7 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php(25): Illuminate\Support\Facades\Gate::policy('XXXXXX\\Model', 'XXXXXXX\\Polic...')
#8 /Users/ahmad/Projects/admin/app/Providers/AuthServiceProvider.php(26): Illuminate\Foundation\Support\Providers\AuthServiceProvider->registerPolicies()
#9 [internal function]: XXXXXX\Providers\AuthServiceProvider->boot()
I added the Gate to my providers array, and tried clearing the bootstrap cache folder and delete the vendor, and reinstall everything in the composer.json
Any advises?
When you upgrade from an older version of Laravel, it may contain some old files or code which are not needed. In my case, I needed to update config/app.php file as per the latest code and it fixed the error.

Trying to upgrade to laravel 5.3 but I keep seeing error `Call to undefined method Illuminate\Auth\Access\Gate::abilities()`

I am trying to upgrade laravel 5.3 from 5.2 but I keep seeing these two errors in my log file:
Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Call to undefined method Illuminate\Auth\Access\Gate::abilities() in /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:237
And this one:
Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Log\Writer::setHandlers() in Command line code:1
Full stack outputs:
[2020-08-13 08:26:58] local.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Uncaught Error: Call to undefined method Illuminate\Auth\Access\Gate::abilities() in /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:237
Stack trace:
#0 Command line code(1): Illuminate\Support\Facades\Facade::__callStatic('abilities', Array)
#1 {main}
thrown in /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:237
[2020-08-13 08:26:58] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Log\Writer::setHandlers() in Command line code:1
Stack trace:
#0 [internal function]: VscodeLaravelExtraIntellisenseProvider->boot()
#1 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Container/Container.php(508): call_user_func_array(Array, Array)
#2 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(769): Illuminate\Container\Container->call(Array)
#3 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(752): Illuminate\Foundation\Application->bootProvider(Object(VscodeLaravelExtraIntellisenseProvider))
#4 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(VscodeLaravelExtraIntellisenseProvider), 2)
#5 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(753): array_walk(Array, Object(Closure))
#6 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Foundation\Application->boot()
#7 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#8 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(267): Illuminate\Foundation\Application->bootstrapWith(Array)
#9 /Users/rohan0793/Code/poptin_v3/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(113): Illuminate\Foundation\Console\Kernel->bootstrap()
#10 Command line code(1): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
I have no idea where these are coming from and how to resolve them.
UPDATE: I see these errors every minute at 41 secs. Example 13:35:41
But according to my crontab in homestead, I don't have any crons scheduled
UPDATE 2: https://github.com/illuminate/auth/blob/5.5/Access/Gate.php the abilities method is present in 5.5. But I am still at 5.3. Weird but I don't know what is calling that code already. Maybe a third party package.
https://marketplace.visualstudio.com/items?itemName=amiralizadeh9480.laravel-extra-intellisense
This VS Code extension was causing the 2 errors, and it was trying to compile something every minute and hence it was very confusing and felt like a cron job running in the background.
Try to find on official documentation for upgrade guide. They cover a lot of issues and maybe you find yours. It's a very specific issue and you are missing something in your code, but from a question, we can't know. https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0
Also try Rector for upgrade or any issue after upgrade https://github.com/rectorphp/rector

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

Ausart Theme Option. I had installed a Theme but i have now this error:

I hope you can help me. I had installed a Theme but i have now this error, what can i do ?
Fatal error: Uncaught Error: Method name must be a string in /Users/vkirov/sworkspace/payin7/payin7-blog/wp-content/themes/ausart/themeple_framework/system/view-gen.inc.php:319 Stack trace: #0 /Users/vkirov/sworkspace/payin7/payin7-blog/wp-content/themes/ausart/themeple_framework/system/view-gen.inc.php(51): themeple_viewgen->generate_element(Array) #1 /Users/vkirov/sworkspace/payin7/payin7-blog/wp-content/themes/ausart/themeple_framework/system/admin-pages-gen.inc.php(168): themeple_viewgen->generate_base_container(Array, 'active_section') #2 /Users/vkirov/sworkspace/payin7/payin7-blog/wp-includes/class-wp-hook.php(286): themeple_adminpages_gen->view_html('') #3 /Users/vkirov/sworkspace/payin7/payin7-blog/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array) #4 /Users/vkirov/sworkspace/payin7/payin7-blog/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #5 /Users/vkirov/sworkspace/payin7/payin7-blog/wp-admin/admin.php(224): do_action('toplevel_page_t...') #6 {main} thrown in /Users/vkirov/sworkspace/payin7/payin7-blog/wp-content/themes/ausart/themeple_framework/system/view-gen.inc.php on line 319
Make sure to have the required php version installed in your server. Theme has a php version limit, any php newer than that (i suppose 5.6) can cause errors.

Categories