I have XAMPP installed and my PHP is:


Every time I need to execute a PHP file I need to do this:

/opt/lampp/bin/php-5.3.8 testando.php

Is there another way to execute it besides using symbolic link?

I did this on /etc/init.d/:

sudo ln -s /opt/lampp/bin/php-5.3.8 php

Why when I need to run PHP I have to do this ./php instead of just php?

And is there a way to do this without the ./? Like it was installed via apt-get?


You can create a symlink in /usr/bin to the PHP binary/executable file.

sudo ln -s /opt/lampp/bin/php-5.3.8 /usr/bin/php should create a symlink to the executable that exists within /usr/bin, and should allow you to call 'php' from the command line without making an /etc/init.d/ entry.

  • That worked but can you explain what is the difference between creating symlink on each folder?
    – user23907
    Jun 5 '12 at 16:53
  • 1
    The way that executable names get run in Bash (or ZSH, or others) is based upon there being either a link or an executable in a folder that is specified in $PATH (btw, please add that to your question's content, see comment to the question). When such executables do not exist in a folder specified in $PATH, you have to use the entire path to the executable to work. By adding that sym link to /usr/bin, the system then recognizes php alone as a command/program. When in the program's folder, though, ./progname: ./ = currentdir, progname = program/executable; Run progname from here.
    – Thomas Ward
    Jun 5 '12 at 16:56
  • 1
    ah, well that's different. Let me (for future reference) point you to the FAQ: This is not the right place for: Linux Mint, Backtrack, and other Linux distributions (try our friends at Unix & Linux Stack Exchange). Ask on U&L in future given that Mint isnt supported here. MODS: Do not move this from Ask Ubuntu please, it does have relevance here even though the OS being used is Mint (this is common in non-apt installed software in all debian distros, so it does have relevence to Ubuntu).
    – Thomas Ward
    Jun 5 '12 at 17:02
  • 1
    $PATH points to where executables are, so the lack of a $PATH doesn't really mean much (since /bin and /usr/bin are both defaults for binaries).
    – Thomas Ward
    Jun 5 '12 at 17:03
  • 1
    This is because of the file system hierarchy standard which describes where resources and executables have to be placed in the file system. Instead of /usr/bin recommended locations are /usr/local/bin or ~/bin .
    – LiveWireBT
    Jun 5 '12 at 17:15