Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AMBasra's avatar

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.

0 likes
2 replies
ChristophHarms's avatar

Try composer dump-autoload, then run tinker again. Did that help?

(Also, please kindly use proper code blocks when posting code or terminal output, it makes your question much easier to read, possibly gaining you more answers. :) )

AMBasra's avatar

@ChristophHarms Thank you for the reply. This is my 1st time posting here. I will take care of it next time. I am used to post at stackoverflow.com. Regarding your question. I have done this multiple times but to no avail. Everytime same error hounds me. I have tried different versions of php using phpbrew. Have also tried with normal php as well.

Please or to participate in this conversation.