zack
zack

Reputation: 75

Yii2 PHP Warning - yii\base\ErrorException symlink(): Cannot create symlink, error code(1314)

I got this error after I updated composer at my Yii2 application.

PHP Warning - yii\base\ErrorException
symlink(): Cannot create symlink, error code(1314)

enter image description here

My code:

 * @return array the path directory and the URL that the asset is published as.
 * @throws InvalidParamException if the asset to be published does not exist.
 */
protected function publishDirectory($src, $options)
{
    $dir = $this->hash($src);
    $dstDir = $this->basePath . DIRECTORY_SEPARATOR . $dir;
    if ($this->linkAssets) {
        if (!is_dir($dstDir)) {
            symlink($src, $dstDir);
        }
    } elseif (!empty($options['forceCopy']) || ($this->forceCopy && !isset($options['forceCopy'])) || !is_dir($dstDir)) {
        $opts = array_merge(
            $options,
            [
                'dirMode' => $this->dirMode,
                'fileMode' => $this->fileMode,
            ]
        );

My 2nd problem: after I run composer diagnose, I got message:

checking composer.json: FAIL.

What is the actual problem?

Upvotes: 0

Views: 176

Answers (1)

RK12
RK12

Reputation: 472

Set linkAssets to false here:

https://github.com/trntv/yii2-starter-kit/blob/master/common/config/web.php#L6

It is a common problem about php symlink() function in Windows systems. There are many posts around the web about it

Upvotes: 1

Related Questions