How to fix lsphp command not working in Ubuntu

While setting up OpenLiteSpeed ​​on my Ubuntu server, I encountered a problem where the lsphp command, a PHP version management tool, did not work. After trying several methods to solve this problem, I found that the problem was with the symbolic link.

The symbolic link issue occurs when the path to the lsphp binary is incorrectly set. Correcting this path will fix the problem. Instead of editing the file, you can simply type a command once to fix the problem.

What is a symbolic link?

lsphp command

A symbolic link is a feature that allows access to the location of an actual file or directory from another location, similar to the shortcut feature in Windows.

ls -s [원본 링크] [링크 경로]

The method to create a symbolic link is the same as the command above.

What is the lsphp -v command?

The lsphp -v command is used to check the LiteSpeed ​​PHP version installed on the server. This command will show you the currently installed PHP version and related information.

lsphp command error message

Command 'lsphp' not found, but can be installed with:
sudo apt install lsphp

When you type the lsphp -v command, you will get the error above. To fix this, you need to create a symbolic link to the lsphp binary so that the system can recognize the command correctly.

Check lsphp binary location

which lsphp

You need to determine the location of the lsphp binary to create the symbolic link.

/usr/local/lsws/lsphp82/bin/lsphp

Usually the path is the same as above, but you need to make sure that ‘lsphp82’ matches the PHP version of your current server. Copy this information and proceed to the next step.

Troubleshooting symbolic links

sudo ln -s /usr/local/lsws/lsphp82/bin/lsphp /usr/bin/lsphp

After you have located the lsphp binary, create a symbolic link using the sudo ln -s command to make the lsphp command available in the system PATH.

In short, it makes /usr/local/lsws/lsphp82/bin/lsphp recognizable from other locations on the system.

sudo /usr/local/lsws/bin/lswsctrl restart

After restarting the system, you can verify that it is working properly by entering the lsphp -v command.

▶ How to install dual WordPress on CyberPanel

▶ How to increase file upload size in CyberPanel admin panel

▶ How to reset your password if you forgot it after installing CyberPanel

Leave a Comment

Your email address will not be published. Required fields are marked *