skip to Main Content

I deployed my website to an apache webserver and try to make tinker work.

I have the problem that I can’t use tinker in Laravel with my user (clashfinder), with the command php artisan tinker.
I get this error message:

ErrorException  : mkdir(): Permission denied

at /var/www/html/clash/vendor/psy/psysh/src/Configuration.php:363
359|             $this->runtimeDir = ConfigPaths::getRuntimeDir();
360|         }
361|
362|         if (!is_dir($this->runtimeDir)) {
> 363|             mkdir($this->runtimeDir, 0700, true);
364|         }
365|
366|         return $this->runtimeDir;
367|     }

Exception trace:

1   mkdir("/run/user/0/psysh")
  /var/www/html/clash/vendor/psy/psysh/src/Configuration.php:363

2   PsyConfiguration::getRuntimeDir()
  /var/www/html/clash/vendor/psy/psysh/src/Shell.php:198

As soon as I execute the command with sudo, it works.

My file permissions inside /var/www/html/clash/ look like this:

-rw-rw-r--   1 clashfinder www-data    220 Aug 13 00:46 .editorconfig
-rw-rw-r--   1 clashfinder www-data    861 Aug 13 00:49 .env
-rw-rw-r--   1 clashfinder www-data    726 Aug 13 00:46 .env.example
-rw-rw-r--   1 clashfinder www-data    111 Aug 13 00:46 .gitattributes
-rw-rw-r--   1 clashfinder www-data    163 Aug 13 00:46 .gitignore
-rw-rw-r--   1 clashfinder www-data    174 Aug 13 00:46 .styleci.yml
-rw-rw-r--   1 clashfinder www-data  29006 Aug 13 00:46 CHANGELOG.md
-rw-rw-r--   1 clashfinder www-data   4455 Aug 13 00:46 README.md
drwxrwxr-x   8 clashfinder www-data   4096 Aug 13 00:46 app/
-rw-rw-r--   1 clashfinder www-data   1686 Aug 13 00:46 artisan
drwxrwxr-x   3 clashfinder www-data   4096 Aug 13 00:46 bootstrap/
-rw-rw-r--   1 clashfinder www-data   1645 Aug 13 00:46 composer.json
-rw-rw-r--   1 clashfinder www-data 197091 Aug 13 00:46 composer.lock
drwxrwxr-x   2 clashfinder www-data   4096 Aug 13 00:46 config/
drwxrwxr-x   5 clashfinder www-data   4096 Aug 13 00:46 database/
drwxrwxr-x 731 clashfinder www-data  24576 Aug 13 00:46 node_modules/
-rw-rw-r--   1 clashfinder www-data 411923 Aug 13 00:46 package-lock.json
-rw-rw-r--   1 clashfinder www-data   1462 Aug 13 00:46 package.json
-rw-rw-r--   1 clashfinder www-data   1297 Aug 13 00:46 phpunit.xml
-rw-rw-r--   1 clashfinder www-data    655 Aug 13 00:46 prod2.json
-rw-rw-r--   1 clashfinder www-data     21 Aug 13 00:46 prod2.lock
drwxrwxr-x   4 clashfinder www-data   4096 Aug 13 00:46 public/
drwxrwxr-x   6 clashfinder www-data   4096 Aug 13 00:46 resources/
drwxrwxr-x   2 clashfinder www-data   4096 Aug 13 00:46 routes/
-rw-rw-r--   1 clashfinder www-data    563 Aug 13 00:46 server.php
-rw-rw-r--   1 clashfinder www-data     68 Aug 13 00:46 socket.sh
drwxrwxr-x   5 clashfinder www-data   4096 Aug 13 00:46 storage/
drwxrwxr-x   4 clashfinder www-data   4096 Aug 13 00:46 tests/
drwxrwxr-x  45 clashfinder www-data   4096 Aug 13 00:46 vendor/
-rw-rw-r--   1 clashfinder www-data    537 Aug 13 00:46 webpack.mix.js

The permissions look correct for me. Can someone tell me why it won’t work with my user?

2

Answers


  1. I think you need to create .psysh.php file in the project root of Laravel.

    and then add:

    <?php
    return [
        'runtimeDir' => './.psysh',
    ];
    
    Login or Signup to reply.
  2. This is an old issue here is a workaround on github tinker issue

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search