I am trying to create symlink in php with following code:
$link = (session_save_path() ? session_save_path() : sys_get_temp_dir()) . "/sess_" . $this->generateSessionId($_REQUEST['broker'], $_REQUEST['token']);
if (!file_exists($link)) $attached = symlink('sess_' . session_id(), $link);
if (!$attached) trigger_error("Failed to attach; Symlink wasn't created.".$link, E_USER_ERROR);
I am using domain name instead of localhost
. I tried to run this code on
Windows 7 with Apache, and Windows 8 with IIS / IIS Express / Apache
Everytime I get same error in logs as follows:
symlink(): Could not fetch file information(error 2)
It would be great if someone can help me out in this, I already spent whole night on this thing.
Finally I found the problem.
I don't know how this code has worked for me before.
But now I checked the full path of file. It was simply session save path was different than temporary files path. So I used same session path in both links and it worked for me.
Still Thank you guys to provide me help about it.