php artisan doesnt work [ErrorException] Undefined offset: 0 in laravel - php

when i try to run php artisan i give the error
[Error Exception]
Undefined offset: 0
when i run composer install or composer update i got this error
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
i install all extensions, run composer dumpautoload but i still get this error. the problem is in this current procjet(i created another laravel project and it works fine)

finally i found out that in service provider, in boot method, there was db query which returned false, so array(where i put db query result) with index 0 doesnt exist
$result[0]->title // <---doesnt exist($result is empty)

Related

Script php artisan optimize handling the post-update-cmd event returned with error code 255?

Today I tried to run a composer update on my laravel project and I got this error. I have no idea what caused this error.
PHP Fatal error: Call to undefined method Illuminate\Foundation\Bootstrap\ConfigureLogging::configureHandler() in /builds/anetwork/campaign-service/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php on line 59
Laravel version is 5.2.45 I try to get version 5.2.25 but I got same error.

Composer update - website stopped working

I updated the Composer using cmd window and got these errors:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Darryldecode\Cart\CartServiceProvider' not found
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
[RuntimeException]
Error Output:
The website is not online yet, and I'm running it using xampp.
Now, when i'm trying to access my web site through localhost, I get this error:
FatalErrorException in ProviderRepository.php line 146:
Class 'Darryldecode\Cart\CartServiceProvider' not found.
In the app.php file I have:
Darryldecode\Cart\CartServiceProvider::class,
in the Application Service Providers, and:
'Cart' => Darryldecode\Cart\Facades\CartFacade::class,
in the aliases.
Any ideas on how to get the website back?
Thanks!
Tty this steps
Temporary remove
Darryldecode\Cart\CartServiceProvider::class,
And
'Cart' => Darryldecode\Cart\Facades\CartFacade::class,
Type command
composer update
And then add this class
Because when you update composer he try to find this path before adding in your project, After updating your composer this class added in your folder

Symfony 2 : Error when cache clear

I have an error when i execute this command :
php app/console cache:clear --env=prod && php app/console cache:clear --env=dev && php app/console assets:install --symlink && php app/console assetic:dump
The error is :
[Symfony\Component\Debug\Exception\ContextErrorException] Catchable
Fatal Error: Argument 1 passed to
Sonata\AdminBundle\Security\Handler\RoleSecurityHandler::__construct()
must implement interface
Symfony\Component\Security\Core\SecurityContextInter face, null
given, called in
/opt/preprod/app/cache/pro_/ap_ProdProjectContainer.php on line 1923
and defined
Can you help i dont really know how to fix this
EDIT
I tried to backup
composer.lock
and
vendor
directory (and then delete them). Then i deleted mannually the cache.
Then i made a composer install but the error is back when i made the composer install.
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
[Symfony\Component\Debug\Exception\ContextErrorException]
Catchable Fatal Error: Argument 1 passed to Sonata\AdminBundle\Security\Handler\RoleSecurityHandler::__construct() must implement interface Symfony\Component\Security\Core\SecurityContextInterface, null given, called in /opt/preprod/app/cache/dev/appDevDebugProjectContainer.php on line 4984 and defined
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
php app/check.php give me everything is ok
So i dont find the way to solve this
What version of Symfony are you using? I would guess 2.8 or 3.0 since it looks like the version of SonataAdminBundle is not compatible with your Symfony version.

Composer/Laravel fresh install error

I've got a brand new laravel installation on DigitalOcean, which I'm attempting to run a basic `composer update' on. However, I'm seeing the following error come up every time I try to update. I can't solve the problem with composer cacheclear, deleting the vendor/compiled.php file, or even reinstalling the entire framework.
I don't understand exactly what the error is in the first place, so I'm a bit lost. Any tips on what's going on?
Script php artisan clear-compiled handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Call to undefined method Illuminate\Foundat
ion\Application::getCachedCompilePath() in /var/www/html/production/vendor/
laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.ph
p on line 28
Delete the vendor/compiled.php and run composer update.
Source: https://laracasts.com/discuss/channels/general-discussion/runtimeexception-on-fresh-install?page=1

Deleting migrations results in an Exception

In my Application, when I run php artisan migrate:make create_location_user_table, then delete the generated file (doesn't matter if I delete the line created in vendor/composer/autoload_classmap.php, the php artisan migrate:refresh command throws an error:
include(<path_to_project>/database/migrations/2015_06_21_105357_create_location_user_table.php): failed to open stream: No such file or directory
After running commands to get rid of the faulty autoload entry, I get an exception. The commands I tried are: composer update, composer dump-autoload, php artisan clear-compiled, php artisan optimize.
PHP Fatal error: Class 'CreateLocationUserTable' not found in <path_to_project>\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php on line 323
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'CreateLocationUserTable' not found
Go into your mysql database manually (PHPMyAdmin) and remove the migrations table. With the steps you've taken above and doing this should solve your issue

Categories