Laravel版本5.0.33
> php artisan tinker
[ErrorException]
mkdir(): Permission denied
这是在生产服务器上,我试图用修补程序测试一个命令作为Web用户。这个用户拥有基本路径中的每个目录,因此我不确定在运行artisan tinker时是否尝试创建了哪个目录。
答案 0 :(得分:6)
使用非常详细的-vvv
,我能够获得堆栈跟踪。
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()尝试在用户主目录中创建文件,而不是应用程序目录。该用户的主页设置为/ var / www / html,但它没有该文件夹的执行权限。
答案 1 :(得分:4)
发生此错误是因为您切换了用户(使用su进行猜测)而没有“破折号”选项。
将su www-data替换为su-www-data,一切正常!
或
su-用户名
其中用户名具有ssh登录权限
用户名前的破折号很重要
引用:here
答案 2 :(得分:1)
将.psysh.php放在具有此内容的Laravel项目的根目录中
<?php
return [
'runtimeDir' => './.psysh',
];
更多信息 https://github.com/laravel/tinker/issues/34#issuecomment-357550126