PHP symlink() fails on Windows 7

后端 未结 3 1522
花落未央
花落未央 2020-12-11 10:55

PHP symlink() function fails on Windows 7 with the error:

Warning: symlink(): Cannot create symlink, error code(3) in C:\\xampp\\htdocs\\…\\lib\\model\\doct         


        
相关标签:
3条回答
  • 2020-12-11 11:17

    I use this

    //symlink($target, $link);
    exec('mklink /j "' . str_replace('/', '\\', $link) . '" "' . str_replace('/', '\\', $target) . '"');
    
    0 讨论(0)
  • 2020-12-11 11:29

    About PHP CLI on windows OS:
    Do not forget to start the console with Run as Administrator else symlink will return false and raise the following error:

    Warning: symlink(): Cannot create symlink, error code(1314)
    
    0 讨论(0)
  • 2020-12-11 11:31

    Might be a bug in PHP 5.3 according to this:

    https://bugs.php.net/bug.php?id=48975

    and this:

    http://forum.wampserver.com/read.php?2,64011 (reply #2)

    Maybe you could upgrade to PHP 5.4 and see if it works?

    0 讨论(0)
提交回复
热议问题