Skip to main content
This guide covers common problems you might encounter with PsySH and how to resolve them.

Installation Issues

Error:
PsySH dependencies not found, be sure to run `composer install`.
See https://getcomposer.org to get Composer.
Cause: PsySH’s dependencies are not installed.Solution:If you cloned the repository:
composer install
If using globally:
composer global require psy/psysh
From bin/psysh:329-332.
Error:
Fatal error: Class 'Psy\Shell' not found
Cause: PsySH is not autoloaded properly.Solution:Ensure you’ve included the Composer autoloader:
require __DIR__ . '/vendor/autoload.php';
Or if installed globally, the psysh binary should handle this automatically.
Error:
Downloading manual v3.0... Failed.
Error: Could not download file
Cause: Network connectivity issues or GitHub unavailable.Solutions:
  1. Check internet connection:
    curl -I https://github.com
    
  2. Check firewall/proxy: Ensure GitHub is not blocked
  3. Try different downloader: PsySH tries cURL, then falls back to file_get_contents
  4. Manual download:
    • Download from PsySH releases
    • Place in ~/.local/share/psysh/php_manual.php

Runtime Errors

Error:
>>> function test() {
PHP Parse error:  syntax error, unexpected end of file
Cause: Multi-line code requires all lines before execution.Solution: Complete the code block:
>>> function test() {
...   return 'hello';
... }
=> null
Or use semicolons to force execution:
>>> function test() { return 'hello'; }
=> null
Error:
>>> echo $myvar
PHP Notice:  Undefined variable: myvar
Cause: Variable hasn’t been defined in current scope.Solution:List defined variables:
>>> ls
Variables: $_
Define the variable first:
>>> $myvar = 'value'
=> "value"

>>> echo $myvar
value
Error: PsySH exits completely after a fatal error.Cause: Process forking is disabled or unavailable.Solution: Enable process forking (requires pcntl extension):In .psysh.php:
return [
    'usePcntl' => true,
];
Install pcntl (if not available):
# On Ubuntu/Debian
sudo apt-get install php-pcntl

# On macOS (already included)
# No action needed

# On Windows
# pcntl is not available
Check if available:
>>> extension_loaded('pcntl')
=> true
Error: Code is stuck in infinite loop, Ctrl+C doesn’t work.Cause: Signal handling is disabled or unavailable.Solutions:
  1. Force terminate: Press Ctrl+\ (SIGQUIT) or kill from another terminal
  2. Enable pcntl for better signal handling:
    return [
        'usePcntl' => true,
    ];
    
  3. Use timeout: Set execution time limit:
    >>> set_time_limit(5);
    >>> while(true) { sleep(1); }
    PHP Fatal error: Maximum execution time of 5 seconds exceeded
    

Configuration Issues

Error: Configuration in .psysh.php is not applied.Cause: Config file is in wrong location or has syntax errors.Solution:
  1. Check file location:
    # Should be in one of:
    ~/.config/psysh/config.php
    # or
    ~/.psysh.php
    # or project root
    .psysh.php
    
  2. Verify syntax:
    php -l ~/.config/psysh/config.php
    
  3. Check return value:
    <?php
    // Must return an array
    return [
        'colorMode' => 'forced',
    ];
    
  4. Use PSYSH_CONFIG environment variable:
    export PSYSH_CONFIG=/path/to/config.php
    psysh
    
Warning:
Warning: Multiple configuration files found:
  - /home/user/.config/psysh/config.php
  - /home/user/.psysh.php
Using /home/user/.config/psysh/config.php
Cause: PsySH found multiple config files and is warning about which one it’s using.Solution: Remove duplicate config files, keep only one:
# Keep the XDG-compliant location
rm ~/.psysh.php
Or disable the warning:
return [
    'warnOnMultipleConfigs' => false,
];
Error: PsySH ignores unknown configuration options.Cause: Typo or invalid option name.Solution: Check valid options in src/Configuration.php:62-98:
return [
    'colorMode',         // not 'colourMode'
    'configDir',         // not 'configDirectory'
    'historyFile',       // not 'historyPath'
    'manualDbFile',      // not 'manualFile'
    'usePcntl',          // not 'enablePcntl'
    'useTabCompletion',  // not 'tabCompletion'
    // ... etc
];

Autoloading Issues

Error:
>>> $obj = new App\MyClass
PHP Fatal error: Class 'App\MyClass' not found
Cause: Project autoloader not loaded.Solution:
  1. Trust the project:
    psysh --trust-project
    
  2. Manually load autoloader:
    >>> require 'vendor/autoload.php'
    >>> $obj = new App\MyClass
    => App\MyClass {#123}
    
  3. Check if autoloader exists:
    ls -la vendor/autoload.php
    
  4. Run composer install if missing:
    composer install
    
Warning:
Skipping project autoload (vendor/autoload.php) in untrusted project ~/project. 
Use --trust-project to allow.
Cause: Project is not in trusted projects list.Solution:Trust the project:
psysh --trust-project
Or configure global trust (not recommended):
return [
    'trustProject' => 'always', // dangerous!
];
See Project Trust for more details.
Warning:
Skipping local PsySH at ~/project (project is untrusted). 
Re-run with --trust-project to allow.
Cause: Project has local PsySH but is not trusted.Solution:
psysh --trust-project
Or run the local version directly:
./vendor/bin/psysh

Display Issues

Problem: Output is plain text without colors.Causes & Solutions:
  1. Terminal doesn’t support colors:
    # Check TERM
    echo $TERM
    # Should be: xterm-256color, screen-256color, etc.
    
  2. Force color mode:
    return [
        'colorMode' => \Psy\Configuration::COLOR_MODE_FORCED,
    ];
    
  3. On Windows: Use Windows Terminal or ConEmu for better color support
Problem: Special characters display as boxes or garbage.Cause: Unicode/UTF-8 not supported or enabled.Solution:
  1. Set terminal encoding to UTF-8:
    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8
    
  2. Disable Unicode in PsySH:
    return [
        'useUnicode' => false,
    ];
    
Problem: Output doesn’t wrap correctly.Solution: PsySH auto-detects terminal width, but you can configure pager:
return [
    'pager' => 'less -R',
];
Or disable pager:
return [
    'pager' => false,
];

Readline Issues

Problem: Up/down arrows don’t recall previous commands.Cause: Readline extension not available or history disabled.Solution:
  1. Check readline:
    >>> extension_loaded('readline')
    => false  // Problem!
    
  2. Install readline:
    # Ubuntu/Debian
    sudo apt-get install php-readline
    
    # macOS (Homebrew)
    brew install php
    
  3. Configure history file:
    return [
        'historyFile' => '~/.psysh_history',
        'historySize' => 5000,
    ];
    
Problem: Tab doesn’t complete code.Cause: Tab completion disabled or unsupported.Solution:Enable tab completion:
return [
    'useTabCompletion' => true,
];
Check if working:
>>> array_m<TAB>
array_map        array_merge      array_multisort
Problem: Pasting code inserts escape sequences.Cause: Bracketed paste mode incompatible with terminal.Solution: Disable bracketed paste:
return [
    'useBracketedPaste' => false,
];

Manual/Documentation Issues

Error:
>>> doc strlen
PHP manual not found.

To document core PHP functionality, download the PHP reference manual:
    doc --update-manual
Solution: Download the manual:
>>> doc --update-manual
Downloading manual v3.0... OK
Installed manual v3.0 to ~/.local/share/psysh/php_manual.php
Error:
Invalid manual file detected: ~/.local/share/psysh/php_manual.php
Cause: Manual file is corrupted or wrong format.Solution: Remove and re-download:
>>> doc --update-manual
Remove this file and continue? [Y/n] y
Downloading manual v3.0... OK
Or manually:
rm ~/.local/share/psysh/php_manual.php
psysh
>>> doc --update-manual
Warning:
Multiple manual database files found: php_manual.php, php_manual.sqlite. 
Using php_manual.php
Cause: Both V2 (SQLite) and V3 (PHP) formats exist.Solution: Remove old SQLite format:
rm ~/.local/share/psysh/php_manual.sqlite
This is informational - PsySH correctly uses the newer format.

Permission Issues

Error:
Data directory is not writable.
Cause: No write permission to data directory.Solution:Fix permissions:
chmod u+w ~/.local/share/psysh
Or use custom directory:
return [
    'dataDir' => '/writable/path/psysh-data',
];
Problem: Command history not persisting between sessions.Cause: History file not writable.Solution:
chmod u+w ~/.config/psysh/psysh_history
Or specify different location:
return [
    'historyFile' => '/tmp/psysh_history',
];
Warning:
Unable to save trust settings. Trusting /path/to/project for this session only.
Cause: Config directory not writable.Solution:
chmod u+w ~/.config/psysh

Performance Issues

Problem: PsySH takes several seconds to start.Causes & Solutions:
  1. Large autoload files: Disable autoload warming:
    return [
        'warmAutoload' => false,
    ];
    
  2. Update checks: Disable automatic updates:
    return [
        'updateCheck' => null,
        'updateManualCheck' => null,
    ];
    
  3. Too many includes: Reduce default includes:
    return [
        'defaultIncludes' => [],
    ];
    
Problem: Tab completion takes a long time.Cause: Large number of classes/functions to scan.Solution: Disable tab completion:
return [
    'useTabCompletion' => false,
];
Or disable autoload warming:
return [
    'warmAutoload' => false,
];

Platform-Specific Issues

Problem: No colored output on Windows.Solution: Use Windows Terminal or enable ANSI support:In PowerShell:
$env:ANSICON = 1
psysh
Or in config:
return [
    'colorMode' => \Psy\Configuration::COLOR_MODE_FORCED,
];
Problem: Process forking features unavailable.Cause: pcntl extension doesn’t exist on Windows.Solution: This is a Windows limitation. Use fallback signal handler:
return [
    'usePcntl' => false,
];
Note: Fatal errors will crash PsySH without pcntl.
Problem: macOS uses libedit instead of GNU Readline.Solution: Install GNU Readline:
brew install php --with-readline
Or configure libedit in ~/.editrc:
bind ^R em-inc-search-prev

Getting More Help

If your issue isn’t covered here:
  1. Check version: Make sure you’re running the latest version:
    composer global update psy/psysh
    
  2. Enable debug output:
    return [
        'verbosity' => \Psy\Configuration::VERBOSITY_DEBUG,
    ];
    
  3. Search issues: Check GitHub Issues
  4. Report a bug: Open a new issue with:
    • PsySH version (psysh --version)
    • PHP version (php -v)
    • Operating system
    • Steps to reproduce
    • Error messages

Build docs developers (and LLMs) love