Installing NES for PHP 5
How to install NES for PHP 5 on Ubuntu 16.04, Ubuntu 22.04, RHEL 6 and RHEL 7
Supported Platforms
| Platform | x86_64 |
|---|---|
| Ubuntu 16.04 | ✅ |
| Ubuntu 22.04 | ✅ |
| RHEL 6 (CentOS 6, Oracle Linux 6) | ✅ |
| RHEL 7 (CentOS 7, Oracle Linux 7) | ✅ |
The current release is v5.6.40-nes-5.6.1, PHP 5.6.40. Once installed, php -v shows
PHP 5.6.40-nes.
Access
NES for PHP 5 is distributed through the NES registry at registry.nes.herodevs.com
and requires an access token. If you do not have one, contact
support@herodevs.com. For more information, see
Access Tokens.
The files of a release are at https://registry.nes.herodevs.com/bin/nes/php/<release>/<file>. Authenticate
with your contact e-mail and your access token.
Ubuntu
The packages keep the usual names (php5.6-cli, php5.6-fpm,
libapache2-mod-php5.6 and the rest), paths and configuration files, and
replace the php5.6 packages a host already has.
Download and verify
In an empty directory, download the signing key, the checksums and the repository for your Ubuntu release:
base=https://registry.nes.herodevs.com/bin/nes/php/v5.6.40-nes-5.6.1
auth="<your-contact-email>:<your-nes-access-token>"
arch=$(dpkg --print-architecture)
for f in RPM-GPG-KEY-php-nes SHASUMS256.txt SHASUMS256.txt.asc "php-v5.6.40-nes-5.6.1.ubuntu1604.$arch.repo.tar.xz"; do
curl -fSLO -u "$auth" "$base/$f"
done
Then verify the downloads:
gpg --with-fingerprint RPM-GPG-KEY-php-nes # must show CA44E935A3995EB733AF292B18DD1E9212F3C6A2
gpg --import RPM-GPG-KEY-php-nes
gpg --verify SHASUMS256.txt.asc SHASUMS256.txt
ls | awk 'NR == FNR { have[$0]; next } $2 in have' - SHASUMS256.txt | sha256sum -c -
Install
Add the repository, then upgrade the PHP packages the host has:
sudo mkdir -p /opt/nes-php
sudo tar -xJf php-v5.6.40-nes-5.6.1.*.repo.tar.xz -C /opt/nes-php --strip-components=1
sudo cp /opt/nes-php/nes-php.list /etc/apt/sources.list.d/nes-php.list
sudo apt-get update
sudo apt-get upgrade
On a host without PHP, install the packages you need instead, for example
sudo apt-get install php5.6-cli php5.6-fpm php5.6-mysql.
Check the installation:
php -v
Configure
Each PHP SAPI reads its own php.ini in /etc/php/5.6/cli/,
/etc/php/5.6/fpm/ or /etc/php/5.6/apache2/. php-fpm is the
php5.6-fpm service and listens on /run/php/php5.6-fpm.sock:
sudo systemctl enable php5.6-fpm
sudo systemctl start php5.6-fpm
Upgrade
Download and verify the new release's repository as above, then:
sudo rm -rf /opt/nes-php && sudo mkdir -p /opt/nes-php
sudo tar -xJf php-<release>.*.repo.tar.xz -C /opt/nes-php --strip-components=1
sudo apt-get update
sudo apt-get upgrade
Uninstall
Remove the NES packages, the ones whose version contains nes:
sudo apt-get purge $(dpkg-query -W -f '${db:Status-Abbrev} ${Package} ${Version}\n' | awk '$1 ~ /^i/ && $3 ~ /[.+]nes[0-9]/ && $2 != "php-common" { print $2 }')
sudo rm /etc/apt/sources.list.d/nes-php.list
sudo rm -rf /opt/nes-php
To go back to the PHP 5.6 packages you used before instead, keep their
repository configured and install their versions with
sudo apt-get install --allow-downgrades <package>=<version>.
RHEL
The packages are for RHEL 6 and RHEL 7, and also serve CentOS 6, Oracle Linux 6, CentOS 7 and Oracle Linux 7.
They have the standard names (php, php-cli, php-fpm, php-mysqlnd and
the rest), paths and configuration files, and replace the PHP 5.6 packages
a host already has.
Download and verify
In an empty directory, download the signing key, the checksums and the repository for your RHEL version:
base=https://registry.nes.herodevs.com/bin/nes/php/v5.6.40-nes-5.6.1
auth="<your-contact-email>:<your-nes-access-token>"
arch=$(uname -m)
for f in RPM-GPG-KEY-php-nes SHASUMS256.txt SHASUMS256.txt.asc "php-v5.6.40-nes-5.6.1.el6.$arch.repo.tar.xz"; do
curl -fSLO -u "$auth" "$base/$f"
done
Then verify the downloads:
gpg --with-fingerprint RPM-GPG-KEY-php-nes # must show CA44E935A3995EB733AF292B18DD1E9212F3C6A2
gpg --import RPM-GPG-KEY-php-nes
gpg --verify SHASUMS256.txt.asc SHASUMS256.txt
ls | awk 'NR == FNR { have[$0]; next } $2 in have' - SHASUMS256.txt | sha256sum -c -
Install
The NES packages do not include php-oci8. If the host has it from its previous repository, remove it first (sudo yum remove php-oci8): while one is installed, yum update stops on its dependencies and changes nothing.
Add the repository, then upgrade the PHP packages the host has (tar needs
xz: sudo yum install xz):
sudo mkdir -p /opt/nes-php
sudo tar -xJf php-v5.6.40-nes-5.6.1.*.repo.tar.xz -C /opt/nes-php --strip-components=1
sudo cp /opt/nes-php/nes-php.repo /etc/yum.repos.d/nes-php.repo
sudo yum update 'php*'
On a host without PHP, install the packages you need instead, for example
sudo yum install php-cli php-fpm php-mysqlnd.
The packages are signed with the release signing key's signing subkey. The rpm of RHEL 6 and 7 reads only a key's primary key, so the repository gives yum that subkey as a key of its own, RPM-GPG-KEY-php-nes-subkey. When yum asks to import it, check that its fingerprint is 3A4BDF48590EBCC891C2133CD75FFA42A9EAF7B9.
Check the installation:
php -v
Configure
PHP reads /etc/php.ini and /etc/php.d/. php-fpm is the php-fpm service.
The Apache module is loaded by /etc/httpd/conf.d/php.conf; restart httpd
after you install or upgrade.
sudo systemctl enable php-fpm
sudo systemctl start php-fpm
Upgrade
Download and verify the new release's repository as above, then:
sudo rm -rf /opt/nes-php && sudo mkdir -p /opt/nes-php
sudo tar -xJf php-<release>.*.repo.tar.xz -C /opt/nes-php --strip-components=1
sudo yum clean metadata
sudo yum update 'php*'
Uninstall
Remove the NES packages and the repository:
sudo yum remove $(rpm -qa --qf '%{NAME} %{RELEASE}\n' | awk '$2 ~ /\.nes\./ { print $1 }')
sudo rm /etc/yum.repos.d/nes-php.repo
sudo rm -rf /opt/nes-php
To go back to the PHP 5.6 packages you used before, install them again from their repository.
Verify Downloads
Every release is signed with the HeroDevs release signing key.
GPG Key Fingerprint: CA44E935A3995EB733AF292B18DD1E9212F3C6A2.
- Import the key from a key server, or from the release's
RPM-GPG-KEY-php-nes:
gpg --keyserver keys.openpgp.org --recv-keys CA44E935A3995EB733AF292B18DD1E9212F3C6A2
- Verify the signature of the checksum file:
gpg --verify SHASUMS256.txt.asc SHASUMS256.txt
- Verify the checksums of the downloaded files:
ls | awk 'NR == FNR { have[$0]; next } $2 in have' - SHASUMS256.txt | sha256sum -c -
apt and yum also check every package's signature when they install it.