Creating symbolic link in linux for PHP which is installed via Xampp

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

This command creates a symbolic link (or shortcut) named php in the /usr/bin directory that points to the actual PHP binary file located in the /opt/lampp/bin directory.

Here is a breakdown of what each part of the command does:

  • sudo: This is a command that allows the user to execute a command with elevated privileges. In other words, it allows the user to execute the command as a superuser or administrator.
  • ln: This is the command that creates symbolic links (also known as soft links) between files or directories.
  • -s: This option specifies that we want to create a symbolic link.
  • /opt/lampp/bin/php: This is the path to the actual PHP binary file that we want to create a symbolic link to.
  • /usr/bin/php: This is the path where we want to create the symbolic link named php.

Therefore, by executing this command, we create a shortcut to the actual PHP binary file that can be accessed from anywhere on the system by simply running the command php. This can be useful for running PHP scripts or applications that require the PHP interpreter.