WordPress Install – Part 4

Return to: Part 3

PHP

I think it’s helpful to know a little history of PHP.

Version 1.0 of PHP was released in 1995. Version 7.0 was released 20 years later in 2015.

Since then, PHP releases have been frequent.

There are important factors involving PHP to consider:

  • WordPress is written in PHP – it benefits from newer versions – and to a degree, requires them.
  • The newest versions of PHP are not always available to each Unix and Unix-like distribution.
  • WordPress requires numerous PHP extension modules. They can be difficult to identify.
  • Because of differences between software repositories provided by Linux distributions, and rapid release of new versions, it can be a challenge to know what to install. In fact, there is a great deal of misinformation among the older published tutorials.

I’ve provided a section in the Technical Notes that address some of the factors involved in identifying and installing the necessary software module packages. It may be helpful to review these notes as a refresher.

A discussion of PHP versions is available here:

reference: https://kinsta.com/blog/php-versions/

Begin PHP installation by repeating the update and upgrade steps as before, and issuing the command sudo APT install php:

~$ sudo apt update↵
~$ sudo apt upgrade↵
~$ sudo apt install php↵

The APT report from installing PHP may look like this:

Take note of the PHP extension modules that are automatically installed due to “dependencies” that are built into this package. It is very possible that your package’s dependencies are different – so it’s important to take note of them.

Also note that most of the extension modules have a version number as part of their name. If you must install or re-install PHP extension modules, you must use the package name for the module that does not contain the version number.

This allows the package management software to use the appropriate versions as necessary to satisfy the dependencies of all installed packages. This is explained at some length in my Technical Notes.

If you re-install a package that has already been installed, APT simply reports that the module is already installed. For example:

wp-ops@seebylooking:~ $ sudo apt install libapache2-mod-php↵
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libapache2-mod-php
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,120 B of archives.
After this operation, 16.4 kB of additional disk space will be used.
Get:1 http://mirror.pit.teraswitch.com/raspbian/raspbian buster/main armhf libapache2-mod-php all 2:7.3+69 [6,120 B]
Fetched 6,120 B in 1s (11.0 kB/s)       
Selecting previously unselected package libapache2-mod-php.
(Reading database ... 157234 files and directories currently installed.)
Preparing to unpack .../libapache2-mod-php_2%3a7.3+69_all.deb ...
Unpacking libapache2-mod-php (2:7.3+69) ...
Setting up libapache2-mod-php (2:7.3+69) ...
wp-ops@seebylooking:~ $

PHP Extensions

The WordPress Handbook maintains a list of PHP extensions WordPress may use.

reference: https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions

It is not necessary to install all of these extension to get WordPress to start. In fact, some of these modules may never be used by a WordPress website.

Instead of installing them all at the beginning, I recommend installing a few key extensions first. Then once WordPress is up and running, use the WordPress Site Health Status tool to highlight other modules that you may wish to install.

Again – identifying the names of these extensions used by your repository may be tricky. Refer to the Technical Notes post for help as necessary.

I recommend installing the following PHP extension modules before preceding to to the next step:

  • libapache2-mod-php
  • php-curl
  • php-cli
  • php-mysql

By installing each of these extensions individually, the APT report will allow you to see if the module was already installed. (As in the example installing libapache2-mod-php above.) . Simply continue on to install the other modules.

Go to: Part 5