Is Your Raspberry Pi Running PHP? Find Out Here!

Learn how to check if PHP is installed on your Raspberry Pi and get the version information. …


Updated October 10, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


Learn how to check if PHP is installed on your Raspberry Pi and get the version information.

  1. Open the terminal on your Raspberry Pi by clicking on the terminal icon or by pressing Ctrl+Alt+T.
  2. Type the following command in the terminal and press Enter:
php -v
  1. If PHP is installed, you will see output similar to this:
PHP 7.4.1 (cli) (built: Apr  8 2020 20:36:29) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

This output shows the version number of your installed PHP and some additional information about the build.

If you see an error message similar to this:

-bash: php: command not found

PHP is not installed on your Raspberry Pi. You can install it using the following steps:

  1. Update the package list by running:
sudo apt update
  1. Install PHP by typing:
sudo apt install php7.4-cli

Note that php7.4 is the current version at the time of writing this article. If a newer version is available, replace 7.4 with the latest version number. 3. Verify the installation by running:

php -v

You should now see the PHP version information as shown in step 3 above.

That’s it! You have successfully checked if PHP is installed on your Raspberry Pi and obtained its version information. If you need to upgrade or downgrade PHP, you can use apt commands like:

sudo apt install php7.4-cli   # install PHP 7.4
sudo apt install php8.0-cli   # install PHP 8.0
sudo apt remove php7.4-cli    # remove PHP 7.4

Remember to replace 7.4 or 8.0 with the desired version number.