Artisan tinker: mkdir () permission denied

Laravel Version 5.0.33

> php artisan tinker

  [ErrorException]            
  mkdir(): Permission denied  

This is on a production server, I tried to test the command with tinker as a web user. This user owns each directory in the base path, so I'm not sure which directory is trying to create when I run artisan tinker.

+5
source share
3 answers

Using very verbose -vvv, I managed to get a stack trace.

Exception trace:
 () at /data1/vhosts/admin.stewartcoopercoon.com/vendor/psy/psysh/src/Psy/Configuration.php:459
 Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at n/a:n/a
 mkdir() at /data1/vhosts/admin.stewartcoopercoon.com/vendor/psy/psysh/src/Psy/Configuration.php:459
 Psy\Configuration->getHistoryFile() at /data1/vhosts/admin.stewartcoopercoon.com/vendor/psy/psysh/src/Psy/Configuration.php:598
 Psy\Configuration->getReadline() at /data1/vhosts/admin.stewartcoopercoon.com/vendor/psy/psysh/src/Psy/Shell.php:78
 Psy\Shell->__construct() at /data1/vhosts/admin.stewartcoopercoon.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/TinkerCommand.php:51
 Illuminate\Foundation\Console\TinkerCommand->fire() at n/a:n/a
 call_user_func_array() at /data1/vhosts/admin.stewartcoopercoon.com/vendor/laravel/framework/src/Illuminate/Container/Container.php:526
 Illuminate\Container\Container->call() at /data1/vhosts/admin.stewartcoopercoon.com/vendor/laravel/framework/src/Illuminate/Console/Command.php:115
 Illuminate\Console\Command->execute() at /data1/vhosts/admin.stewartcoopercoon.com/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
 Symfony\Component\Console\Command\Command->run() at /data1/vhosts/admin.stewartcoopercoon.com/vendor/laravel/framework/src/Illuminate/Console/Command.php:101
 Illuminate\Console\Command->run() at /data1/vhosts/admin.stewartcoopercoon.com/vendor/symfony/console/Symfony/Component/Console/Application.php:874
 Symfony\Component\Console\Application->doRunCommand() at /data1/vhosts/admin.stewartcoopercoon.com/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at /data1/vhosts/admin.stewartcoopercoon.com/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /data1/vhosts/admin.stewartcoopercoon.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:94
 Illuminate\Foundation\Console\Kernel->handle() at /data1/vhosts/admin.stewartcoopercoon.com/artisan:36

getHistoryFile () tries to create a file in the user's home directory, and not in the application directory. This user house was installed in / var / www / html, but it did not have execute rights in this folder.

+6
source

- , ( su) "".

su www-data su - www-data, !

su -

username ssh

:

+3

Put .psysh.php in the root of the Laravel project with this content

<?php
return [
        'runtimeDir'    => './.psysh',
    ];

Additional information https://github.com/laravel/tinker/issues/34#issuecomment-357550126

+1
source

Source: https://habr.com/ru/post/1666556/


All Articles