A Step-by-Step Guide for Beginners

Learn how to verify if PHP is installed and working correctly on your Raspberry Pi. This article will provide a simple, straightforward guide for beginners using the command line interface. …


Updated August 30, 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 verify if PHP is installed and working correctly on your Raspberry Pi. This article will provide a simple, straightforward guide for beginners using the command line interface.

Step 1: Open the Terminal

To begin, open the terminal application by clicking on the “Menu” icon in the top left corner of your Raspberry Pi desktop, then navigate to “Accessories” > “Terminal.” Alternatively, you can use the keyboard shortcut Ctrl+Alt+T to open it.

Step 2: Check for PHP Version

In the terminal window, type the following command and press Enter:

php -v

If PHP is installed on your Raspberry Pi, this will display the current version number, followed by additional information about your installation. If you receive an error message instead, such as command not found, then PHP is not currently installed.

Step 3: Install PHP (if necessary)

If PHP is not installed, you can add it to your Raspberry Pi using the following commands:

sudo apt-get update
sudo apt-get install php7.0-cli php7.0-fpm

Replace php7.0 with the desired version of PHP if necessary (e.g., php8.0). These commands will update your package lists and install the required packages for running PHP on your Raspberry Pi.

Step 4: Verify Installation

After installation is complete, run the php -v command again to verify that it’s working correctly. You should see the PHP version information displayed in the terminal.

Now you can use PHP on your Raspberry Pi! If you need additional packages or modules for specific functionality, you may install them using the same apt-get commands as before.