• PHP Manual
  • Function Reference
  • File System Related Extensions
  • Filesystem
  • Filesystem Functions
  • basename
  • chgrp
  • chmod
  • chown
  • clearstatcache
  • copy
  • delete
  • dirname
  • disk_free_space
  • disk_total_space
  • diskfreespace
  • fclose
  • fdatasync
  • feof
  • fflush
  • fgetc
  • fgetcsv
  • fgets
  • fgetss
  • file
  • file_exists
  • file_get_contents
  • file_put_contents
  • fileatime
  • filectime
  • filegroup
  • fileinode
  • filemtime
  • fileowner
  • fileperms
  • filesize
  • filetype
  • flock
  • fnmatch
  • fopen
  • fpassthru
  • fputcsv
  • fputs
  • fread
  • fscanf
  • fseek
  • fstat
  • fsync
  • ftell
  • ftruncate
  • fwrite
  • glob
  • is_dir
  • is_executable
  • is_file
  • is_link
  • is_readable
  • is_uploaded_file
  • is_writable
  • is_writeable
  • lchgrp
  • lchown
  • link
  • linkinfo
  • lstat
  • mkdir
  • move_uploaded_file
  • parse_ini_file
  • parse_ini_string
  • pathinfo
  • pclose
  • popen
  • readfile
  • readlink
  • realpath
  • realpath_cache_get
  • realpath_cache_size
  • rename
  • rewind
  • rmdir
  • set_file_buffer
  • stat
  • symlink
  • tempnam
  • tmpfile
  • touch
  • umask
  • unlink
stat
tempnam
Filesystem Functions
PHP Manual

symlink

Creates a symbolic link

Description

bool symlink(string $target, string $link)

symlink creates a symbolic link to the existing target with the specified name link.

Parameters

target

Target of the link.

link

The link name.

Return Values

Returns true on success or false on failure.

Errors/Exceptions

The function fails, and issues E_WARNING, if link already exists. On Windows, the function also fails, and issues E_WARNING, if target does not exist.

Examples

Example #1 Create a symbolic link

<?php
$target = 'uploads.php';
$link = 'uploads';
symlink($target, $link);

echo readlink($link);
?>

See Also

  • is_link
  • link
  • readlink
  • linkinfo
  • unlink