I'm trying to create a symbolic link on Ubuntu 10.04 ((Lucid Lynx)) it says:

me@laptop:~/PHPUnit$ ls
assertions.php      LICENSE      PHPUnit           README.markdown
build.xml           package.xml  phpunit.bat       Tests
ChangeLog.markdown  phpunit      phpunit.xml.dist
me@laptop:~/PHPUnit$ ln -s phpunit /usr/bin/phpunit
ln: accessing `/usr/bin/phpunit': Too many levels of symbolic links

And when I do /usr/bin$ ls php* I just get:

php  php5  php-config  php-config5  phpize  phpize5

I tried to create it before, and I'm not sure if I run a wrong command...

  • try to specify the full path of phpunit
    – Heisenbug
    Aug 12, 2011 at 11:45

1 Answer 1


Beware that using ln -s target /path/symlink, the target will be interpreted as relative to the path directory (where the symlink will belong). Your command would create a symlink that points to itself. Hence, a path lookup loop would occur every time the symlink is accessed.

In your case, maybe /usr/bin/phpunit already exists and is self-looping. Remove it first and change your command to:

me@laptop:~/PHPUnit$ ln -s ~/PHPUnit/phpunit /usr/bin/phpunit

(Using an absolute target is probably the best here)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .