Octopus
Octopus

Reputation: 165

Symlink is not getting created

Am trying to create a symlink using PHP function.

symlink($target, $source);
$target = '/var/www/html/test/magento/';
$source = '/var/www/html/test/magento/var/log/system.log';

But getting an error like

Warning: symlink(): File exists

Expected result: system.log should be created as a symlink under /var/www/html/test/magento.

Actual Result: No symlink is created.

How to resolve this issue?

Upvotes: 0

Views: 187

Answers (1)

Federico klez Culloca
Federico klez Culloca

Reputation: 27119

You're creating a link called system.log inside /var/www/html/test/magento/var/log, pointing to /var/www/html/test/magento/.

I think what you wanted may rather be

$target = '/var/www/html/test/magento/var/log/system.log';
$link = '/var/www/html/test/magento/system.log';
symlink($target, $link);

Upvotes: 2

Related Questions