Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 255
AMBasra Avatar asked Aug 16 '17 14:08

AMBasra


People also ask

What is php artisan tinker in Laravel?

Tinker allows you to interact with your entire Laravel application on the command line, including your Eloquent models, jobs, events, and more. To enter the Tinker environment, run the tinker Artisan command: php artisan tinker.

Can php artisan serve?

The Laravel PHP artisan serve command helps running applications on the PHP development server. As a developer, you can use Laravel artisan serve to develop and test various functions within the application. It also accepts two additional options. You can use the host for changing application's address and port.


1 Answers

I fixed it finally by upgrading my version of laravel. Laravel v5.4.0 to Laravel v5.4.33.

like image 72
AMBasra Avatar answered Sep 21 '22 13:09

AMBasra