Gaming industry under DDoS attack. Get DDoS protection now. Start onboarding
  1. Home
  2. Developers
  3. How to Check the PHP Version

How to Check the PHP Version

  • By Gcore
  • May 19, 2023
  • 2 min read
How to Check the PHP Version

PHP, one of the most commonly used programming languages for building websites and applications, is often utilized in popular Content Management Systems (CMS) like WordPress, Joomla, and ModX. Following the installation of any CMS, you might need to verify your PHP version to understand its specific functionalities. Below, we describe two ways to check your PHP version.

Please note: To check the PHP version, you’ll need server access.

Method #1: Checking PHP Version via the command line

1. Connect to your server using SSH.

2. Execute the following command:

php -v

This command should generate an output similar to:

PHP 7.3.21 (cli) (built: Aug  4 2020 11:52:37) ( NTS )Copyright (c) 1997-2018 The PHP GroupZend Engine v3.3.21, Copyright (c) 1998-2018 Zend Technologies

The first line of the output reveals the installed PHP version, which in this case, is PHP 7.3.21.

Method #2: Checking PHP Version via a PHP File

1. Connect to your server via FTP or SSH.

2. In your server’s root directory, create a new PHP file, for instance, phpinfo.php. Inside this file, use the phpinfo() function:

<?phpphpinfo();?>

3. In your web browser, navigate to https://your-server/phpinfo.php (be sure to replace “your-server” with your server’s IP address or domain name). The installed PHP version will be displayed on the first line of the resulting page.

For example, the output might show that the PHP version is 7.4.3.

Note: After verifying your PHP version, remember to delete or secure the phpinfo.php file. This file contains detailed server information and could pose a security risk if left publicly accessible.

Conclusion

Developing with PHP and need an efficient cloud solution? Gcore’s offerings have you covered.

  • Web Application Security enhances the security of your PHP applications by protecting them from web-based threats, ensuring a secure experience for your website’s visitors.
  • Managed Database for PostgreSQL provides a hassle-free database management solution, making it easier to handle data-driven operations in your PHP applications.
  • Virtual Instances.
  • Bare Metal offers the ultimate in server power and performance with an entire server dedicated to your needs alone.

Start coding with PHP on Gcore today

Related articles

Multi-Cloud Plan: What It Is and How It Works

Your cloud provider goes down. Applications fail. Customers can't access your services. And because you've built everything around a single vendor, there's nothing you can do but wait. For organizations locked into one cloud platform, this

Vendor Lock-In in Cloud Computing: What It Is and How to Avoid It

Imagine discovering that migrating your company's data to a new cloud provider will cost hundreds of thousands of dollars in egress fees alone, before you've even touched the re-engineering work. Or worse, picture being in Synapse Financial

What Is Sovereign Cloud and Why Does It Matter?

Picture this: a foreign government issues a legal order forcing your cloud provider to hand over sensitive patient records, classified research data, or critical national infrastructure details. You can't stop it. This isn't hypothetical. G

Types of Virtualization in Cloud Computing

Your physical servers are sitting idle at 15% to 20% CPU utilization while you're paying for 100% of the power, cooling, and hardware costs. Meanwhile, your competitors have consolidated 10 to 15 applications per server, pushing utilization

What's the difference between multi-cloud and hybrid cloud?

Multi-cloud and hybrid cloud represent two distinct approaches to distributed computing architecture that build upon the foundation of cloud computing to help organizations improve their IT infrastructure.Multi-cloud environments involve us

What is multi-cloud? Strategy, benefits, and best practices

Multi-cloud is a cloud usage model where an organization utilizes public cloud services from two or more cloud service providers, often combining public, private, and hybrid clouds, as well as different service models, such as Infrastructur

Subscribe to our newsletter

Get the latest industry trends, exclusive insights, and Gcore updates delivered straight to your inbox.