How do i install the latest version of php?

Current Stable PHP 8.1.10 [Changelog]

  • php-8.1.10.tar.gz [sig] [19,283Kb] 01 Sep 2022 3ea4f323109dfbc8d2631d08aa0e08602c1f713678e9dc6c750f081ef49eab0f
  • php-8.1.10.tar.bz2 [sig] [15,052Kb] 01 Sep 2022 2de8e0402285f7c56887defe651922308aded58ba60befcf3b77720209e31f10
  • php-8.1.10.tar.xz [sig] [11,461Kb] 01 Sep 2022 90e7120c77ee83630e6ac928d23bc6396603d62d83a3cf5df8a450d2e3070162
  • Windows downloads

GPG Keys for PHP 8.1

Old Stable PHP 8.0.23 [Changelog]

  • php-8.0.23.tar.gz [sig] [17,106Kb] 01 Sep 2022 a2dd50e9c4a0328d921b6bc914e8b4e6572f94f09867318f88acca5ac4fa76c7
  • php-8.0.23.tar.bz2 [sig] [13,312Kb] 01 Sep 2022 1412db46800a45ced377c2892ec6261b3c412f13dc133bfc998cfb2f147b40cf
  • php-8.0.23.tar.xz [sig] [10,606Kb] 01 Sep 2022 65e474b6bd8cfc9d4a8a56268a755e2f9d3e7499e1687e6401a9f2b047600f87
  • Windows downloads

GPG Keys for PHP 8.0

Old Stable PHP 7.4.30 [Changelog]

  • php-7.4.30.tar.gz [sig] [16,471Kb] 09 Jun 2022 e37ea37e0f79109351ac615da85eb7c2c336101fc5bc802ee79a124a4310dc10
  • php-7.4.30.tar.bz2 [sig] [12,720Kb] 09 Jun 2022 b601bb12e53720469b60ea816776cac1c0696b09888a11ad2379b2eee835386e
  • php-7.4.30.tar.xz [sig] [10,175Kb] 09 Jun 2022 ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d
  • Windows downloads

GPG Keys for PHP 7.4

GPG Keys

The releases are tagged and signed in the PHP Git Repository. The following official GnuPG keys of the current PHP Release Manager can be used to verify the tags:

PHP 8.1

pub   2048R/31CBD89E 2016-12-08
      Key fingerprint = 5289 95BF EDFB A719 1D46  839E F9BA 0ADA 31CB D89E
uid                  Joe Watkins 

pub   rsa4096 2021-04-26 [SC] [expires: 2025-11-24]
      39B6 4134 3D8C 104B 2B14  6DC3 F9C3 9DC0 B969 8544
uid           [ultimate] Ben Ramsey 
sub   rsa4096 2021-04-26 [E] [expires: 2025-11-24]

pub   rsa4096 2021-04-01 [SC]
      F1F6 9223 8FBC 1666 E5A5  CCD4 199F 9DFE F6FF BAFD
uid           [ultimate] Patrick Allaert 
sub   rsa4096 2021-04-01 [E]
  

PHP 8.0

pub   4096R/70D12172 2017-04-14 [expires: 2024-04-21]
      Key fingerprint = 1729 F839 38DA 44E2 7BA0  F4D3 DBDB 3974 70D1 2172
uid                  Sara Golemon 

pub   rsa4096 2020-05-09 [SC] [expires: 2024-05-08]
      BFDD D286 4282 4F81 18EF  7790 9B67 A5C1 2229 118F
uid           [ultimate] Gabriel Caruso [Release Manager] 
sub   rsa4096 2020-05-09 [E] [expires: 2024-05-08]

pub   rsa4096 2022-08-30 [SC] [expires: 2024-08-29]
      2C16 C765 DBE5 4A08 8130  F1BC 4B9B 5F60 0B55 F3B4
uid           [ultimate] Gabriel Caruso 
sub   rsa4096 2022-08-30 [E] [expires: 2024-08-29]
  

PHP 7.4

sec   rsa4096 2019-06-11 [SC] [expires: 2029-06-08]
      5A52880781F755608BF815FC910DEB46F53EA312
uid           [ultimate] Derick Rethans 
uid           [ultimate] Derick Rethans 
uid           [ultimate] Derick Rethans [GitHub] 
uid           [ultimate] Derick Rethans [PHP] 
ssb   rsa4096 2019-06-11 [E] [expires: 2029-06-08]

pub   rsa4096 2019-05-29 [SC] [expires: 2021-05-28]
      4267 0A7F E4D0 441C 8E46  3234 9E4F DC07 4A4E F02D
uid           [ultimate] Peter Kokot 
sub   rsa4096 2019-05-29 [E] [expires: 2021-05-28]
  

A full list of GPG keys used for current and older releases is also available.

Setting up a server can be a daunting task, especially when installing languages like PHP. If you want to get a WordPress test server up and running, it’s a necessary skill to learn.

Got no idea where to start to get PHP on your server? Depending on your unique setup, there are many ways to do it. Where do you download PHP, which version, what do you need to make it work, and how do you install PHP on various OSes?

We’ll answer them all in this one-stop PHP installation guide.

Let’s begin!

Check out our video guide to installing PHP

What is PHP?

PHP logo

PHP is an open source scripting language primarily used for web development and server-side [backend] scripting. In simple terms:

  • PHP can be installed on a server to run scripts [e.g. pieces of code to add forms to your site].
  • It is run server-side rather than client-side, so it works in the backend rather than in the browser.
  • It integrates well with HTML, making it highly suitable for web development.

It’s also one of the easiest web scripting languages to learn, making it a popular choice for beginners. But it’s also quite powerful and suitable for advanced website functions.

Many websites and tools use PHP and its many extensions [.NET, Apache, and MySQL may sound familiar]. WordPress is built primarily on PHP, and most of its plugins and themes also run on it.
[CTA]

Does Your Server Need PHP?

So you know what PHP is, but why should you install it on your server?

The most notable reason is that it’s a requirement to get WordPress up and running, as it’s built almost exclusively on PHP. PHP also powers most WordPress functions, hooks, themes, and plugins.

You can see all the other WordPress system requirements here:

WordPress requirements

So, if you want to run a WordPress test server to play around with or set up a staging site, you’ll need to install PHP.

Besides that, PHP is a great launching point for beginner devs. It’s straightforward to use compared to other web scripting languages, but that doesn’t come at any expense of functionality. You can do all sorts of things with it if you’re skilled enough.

PHP is also quite popular. So, you can find plenty of extensions and resources online.

Besides that, if you want to learn to code WordPress themes and plugins, you’ll need to learn PHP. Setting up a test server is a great way to experiment.

Do note that many web hosting servers [such as Kinsta] come preinstalled with PHP and WordPress. Kinsta even includes the ability to create a WordPress staging site, so that’s easy to get at too.

The only reason you’ll need to do this manually is if you’re setting up a server from scratch, either on your local computer or in an unmanaged hosting environment.

That said, let’s get into the server setup instructions.
[CTA]

PHP Prerequisites

Before installing PHP, you’ll need to make sure your server can handle it. Luckily, the requirements are fairly basic, and a lot of the software is likely already installed on your computer.

If you’ve never created a server before, you should check out this guide to set up a local server on multiple OSes. The exact specifics vary depending on your operating system, but you should know how to work with the command line and be ready to install new software.

Whatever operating system you’re installing PHP on, you’ll need a web server to run it. You’ll also likely need to install a database like MySQL, so keep that in mind.

Here are the PHP prerequisites for each OS, starting with Linux:

  • An ANSI C compiler.
  • Module-specific components like GD graphics libraries or PDF libraries.
  • Optional: Autoconf 2.59+ [for PHP versions < 7.0], Autoconf 2.64+ [for PHP versions > 7.2], Automake 1.4+, Libtool 1.4+, re2c 0.13.4+, and Bison.

You should also be familiar with navigating Unix-like OSes already.

Now the PHP requirements for Windows:

  • Multiple Windows OSes are supported on PHP 5.5+, but 7.2.0+ users cannot use Windows 2008 or Windows Vista.
  • Visual C Runtime [CRT].
  • Visual Studio 2012, 2015, 2017, or Microsoft Visual C++ Redistributable for Visual Studio 2019, depending on your PHP version.

Lastly, there are no prerequisites for macOS because PHP comes bundled with the system. We’ll explain how to enable it below.

Where to Download PHP

If you need to download the PHP files manually, you should get them from the official site’s PHP downloads page.

Avoid installing it from third-party sites unless you know they’re safe, as downloading files from third-party sites can lead to accidentally installing malware.

PHP downloads page

If you’re downloading for a Windows machine, look for the “Windows downloads” link in each version of PHP and make sure you’re installing the proper files.

You can also install older versions of PHP, but this is not recommended unless you know what you’re doing, as they expose your server to bugs and major security flaws.

If you’re running a Linux distribution, you usually don’t need to get the files through the website, and you should use the command line. We’ll go over that in detail below.

Which PHP Version Should I Use?

If you’ve clicked that download link above, you’re likely looking at all those files and feeling overwhelmed. Which PHP version is the right one?

Generally speaking, if you’re starting a brand new project where compatibility issues aren’t a problem, you should get the latest stable version of PHP.

It is sometimes possible to download beta versions of PHP, which are even newer, but these are often buggy and only released to help the developers gather feedback. Most of the time, you should stick with the stable releases.

What about older versions? Every PHP version comes with new features, but that means new incompatibilities with older features. If you need to do something specific that{s not supported on the latest PHP version, you can use an older version, but you should stick only with the currently supported versions.

If you’re not sure, then use the latest version of PHP.

Take note that WordPress is only compatible with certain versions of PHP. It technically supports PHP versions starting at 5.6.20+, but these are quite old and thus not recommended. Versions 7.2 to 7.4 are currently the best-supported versions for WordPress.

PHP version 8 is also compatible, but currently, this is very new, and not all plugins work properly. If you’re worried about compatibility issues, stick with PHP version 7.4. You can read our PHP benchmarks post to see how various PHP CMSes and frameworks perform on different PHP versions.

How to Install PHP on Linux

Before starting, you should be familiar with the Terminal and how to operate Unix-like OSes in general. Generally, these command line codes should work on any Linux distribution that uses the normal syntax in the Terminal, but we’ve left some notes below for specific OSes.

First, you should make sure your packages are up to date, so run this Linux command in the Terminal.

sudo apt-get update && sudo apt-get upgrade

Now you’re ready to install PHP. The command to do so is effortless and straightforward.

sudo apt-get install php
Installing PHP via terminal

This will install the latest version of PHP along with several extensions. You can use this code to see which version you have.

php –v

What if you want to install a specific version of PHP, such as PHP 7.4? You’ll need to use a PPA, or Personal Package Archive, by Ondřej Surý. This is a safe way to install older supported versions of PHP. Run these three commands one at a time:

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

Now your system recognizes the archive, and you can install PHP 7.4. Type in the following command:

sudo apt install php7.4

And of course, you can replace this number with whatever PHP version you want.

That covers the basics, but if you need extra help with configuration, the PHP installation documentation for Unix can help.

Installing PHP on Ubuntu

For Ubuntu users, there aren’t many specific concerns as long as you follow the guide above. Ubuntu is one of the most popular distributions, so most Linux guides are practically made for that system.

One alternative option available to you is downloading a LAMP stack. LAMP stands for Linux, Apache, MySQL, and PHP. It’s essentially a bundle of all the software you need to get a server up and running.

While you can manually download each of these tools separately, you could get Taskel, a bundle that will install all these at once. Just run these two commands in succession in the Terminal:

sudo apt install tasksel
sudo tasksel install lamp-server
Installing LAMP stack with Taskel via terminal

Installing PHP on CentOS 7

This operating system is a little different from other Linux distributions. On CentOS, the apt and apt-get commands are not the ideal ways to install the software. Instead, it uses yum, Yellowdog Updater Modified, a better package manager for RHEL-based operating systems.

Otherwise, the commands you’ll need to use are pretty similar. To update your packages, run this command instead:

sudo yum install epel-release && sudo yum update

As for other commands, you can usually replace apt-get with yum. To install PHP, use this command.

sudo yum install php

PHP commands such as php –v should work the same on CentOS 7, so you don’t need to worry about that.

Installing PHP on Debian

Last for Unix-like operating systems is Debian. This time there are just a few minor concerns, but most of the commands listed above should work fine.

For Debian, you can use either apt-get or aptitude in your Terminal commands. The aptitude command is a little more comprehensive and provides a menu interface. It’s up to personal preference which you use, and either will get the job done.

So instead of using the usual apt-get command, you could run this one instead:

sudo aptitude install php

Debian can be finicky. If you find PHP isn’t parsing or extensions aren’t working, make sure you’ve updated your server’s web configuration file and that it’s loading the extension ini files.

Besides a few small things, instructions for Debian are practically identical to those for other Linux distributions.
[CTA]

How to Install PHP on Windows

If you’re using a Windows system, unlike macOS and Linux, you don’t need to install PHP through the command line [though it is an option if you’d prefer].

An easy way to install PHP from here is to enable IIS and then use WebPI to install PHP. After launching WebPI, you can find it under the Products tab. Click Add on the version you want, then click Install.

Enabling IIS on Windows

You can also download PHP for Windows and manually configure it to work with IIS. Make sure to get a non-thread-safe version if you’re using IIS.

If all this is too complicated, you could instead install WampServer or XAMPP, as these come with everything you need to start working with a web server: Apache, a database, and of course PHP.

These instructions will work with most modern Windows OSes such as Windows 10, 7, and Vista. If you’re using an older version of Windows, you should check out the legacy Windows installation documentation.

Windows may need a little extra configuration to get PHP working properly, so make sure to check the recommended Windows configuration documentation. You just have to make a few small ini tweaks.

How to Install PHP on macOS

PHP comes preinstalled on most macOS systems, so you usually don’t need any manual installation.

All you need to do is uncomment a few lines of code in the Apache configuration file httpd.conf, which you can usually find at /private/etc/apache2/httpd.conf. Uncomment these two lines by removing the hashtag symbol:

# LoadModule php5_module libexec/httpd/libphp5.so
# AddModule mod_php5.c

You may need to do extra configuration if you don’t like some file settings’ default values. Otherwise, find the DocumentRoot, then create and load a PHP file with this code:

You can always check the PHP version with the php –v command to make sure PHP was installed correctly.

If you do need to download PHP manually, then you should install Homebrew and use this simple command:

brew install php

All About PHP Extensions

Once you’ve got PHP up and running, it’s a good idea to think about extensions. These compiled libraries add all sorts of extra, helpful functionality. Think of them as plugins that add on to what PHP already offers. Some of these are required to run PHP frameworks, such as Laravel and Symfony.

While it’s completely possible to code everything yourself without ever touching an extension, there’s no reason to do it all on your own when widely-used shortcuts exist to make your life easier.

PHP already comes with dozens of built-in extensions, some of which you must enable manually, and others you can start using right away. You can also install PHP extensions through sites like PECL, which hosts hundreds of third-party packages.

The PHP manual offers extension documentation for many of these as well, so you can get the hang of using them.

Not sure where to start? Here are just a handful of a few popular PHP extensions:

  • Apache: Apache is a widely used web server software recommended by WordPress due to its great compatibility with it and PHP. Apache comes bundled with PHP, so you don’t need to install it manually.
  • .NET: .NET is a popular software framework that you can use to build web applications and more. It works with multiple languages, including PHP. You may also be interested in PeachPie, which allows you to run PHP code in .NET.
  • MySQLi: A better version of the old MySQL extension, MySQLi enables you to work with MySQL database software. This one is a must-have to help you set up your database.

Whenever you install an extension, you need to uncomment it. Just open up php.ini and remove the semicolon [;] in front of extension=extensionname.

You should also check out these PHP frameworks if you’d like to standardize your code and build with premade libraries. They’re a great way to get started with developing web applications with PHP.

Summary

Whatever operating system you’re using, installing PHP isn’t such a hard process. If you want to make a WordPress test server, you’ll need it. Aspiring PHP programmers will find setting up a web server and installing PHP on it a great exercise.

Make sure you download PHP either through the command line or from its official site. You can either get the latest stable version of PHP or any other version compatible with WordPress.

And if you’d like to get started with developing WordPress sites right away, you can try DevKinsta! It comes with PHP preinstalled. It also lets you hot-swap between different PHP versions so that you can test your site in different server environments.

Save time, costs and maximize site performance with:

  • Instant help from WordPress hosting experts, 24/7.
  • Cloudflare Enterprise integration.
  • Global audience reach with 34 data centers worldwide.
  • Optimization with our built-in Application Performance Monitoring.

All of that and much more, in one plan with no long-term contracts, assisted migrations, and a 30-day-money-back-guarantee. Check out our plans or talk to sales to find the plan that’s right for you.

How do I install a new version of PHP?

Follow the below steps to install PHP on Windows: Step 1: Visit //www.php.net/ website using any web browser and click on Downloads. Step 2: Click on the Windows “Downloads” button. Step 3: The new webpage has different options, choose the Thread safe version, and click on the zip button and Download it.

What is the latest version of PHP 2022?

W3Techs reports that, as of January 2022, "PHP is used by 78.1% of all the websites whose server-side programming language we know." PHP version 7.4 is the most used version. ... PHP..

How do I download and install PHP?

Install PHP on Windows manually You have to download zipped binary version of PHP from //www.php.net/downloads.php. Extract the downloaded file to php folder which must be created at the root of any of your windows drives [e.g. c:\php or d:\php]. Enter php folder and rename the file php. ini-recommonded to php.

What is the latest PHP version available?

Complete Guide to PHP Versions.

Chủ Đề