php artisan tinker Psy\Exception\RuntimeException Unable to create PsySH runtime directory

Modified on Thu, 14 Oct, 2021 at 7:38 PM

In some cases, you might experience problems when running php artisan tinker in a shared hosting environment. The problem might be similar to this:

Psy\Exception\RuntimeException

  Unable to create PsySH runtime directory. Make sure PHP is able to write to /run/user/10057 in order to continue.

To resolve this issue, create the folder ~/.config/psysh/ and the file ~/.config/psysh/config.php. The contents should be like this. When you have SSH access, you can run the snippet below.

<?php
return [
    'runtimeDir' => '~/tmp'
];

Note: ~ equals the home folder and gets automatically resolved. For DirectAdmin and cPanel this is /home/username/ and for Plesk this is /var/www/vhosts/hoofddomeinnaam.

SSH command for fixing php artisan tinker  Psy\Exception\RuntimeException
 Unable to create PsySH runtime directory

mkdir ~/.config/psysh/ -p
echo "<?php
return [
    'runtimeDir' => '~/tmp'
];" >> ~/.config/psysh/config.php


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article