'Call to undefined function Illuminate\Filesystem\symlink()

I am installing a php script on my server as a test but I'm experiencing this error. Since I am a begginer in PHP language I am having trouble understanding what is wrong with the script code.

I enabled debug mode on the application and got this error message ''Call to undefined function Illuminate\Filesystem\symlink()''

and this is the code The line that says: "return symlink($target, $link);" is the line where debug found the error.

public function copy($path, $target)
{
    return copy($path, $target);
}

/**
 * Create a symlink to the target file or directory. On Windows, a hard link is created if the target is a file.
 *
 * @param  string  $target
 * @param   string $link
 * @return void
 */
public function link($target, $link)
{
    if (!windows_os()) {
        return symlink($target, $link);
    }
    $mode = $this->isDirectory($target) ? 'J' : 'H';
    exec("mklink /{$mode} ".escapeshellarg($link).' '.escapeshellarg($target));
}

/**
 * Create a relative symlink to the target file or directory.
 *
 * @param  string  $target
 * @param   string $link
 * @return void
 */
public function relativeLink($target, $link){
    
}


Solution 1:[1]

I have the same problem and the solution proved simple:

First, ssh to the server, navigate to your project folder, then delete the symlink from the public folder:

cd public
unlink storage

Finally, run the command to create the symlink manually (assuming we are still in public/):

ln -s ../storage/app/public storage

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nasser Albelbeisi