Lunarpages Web Hosting Forum

Author Topic: Updating from the PHP 5.6 instance on a Dedicated Server  (Read 2017 times)

Offline AdrianAvadani

  • zombie
  • Administrator
  • Galactic Royalty
  • *****
  • Posts: 237
Updating from the PHP 5.6 instance on a Dedicated Server
« on: January 18, 2019, 01:16:05 AM »
Hello,

This is a repost for https://www.lunarpages.com/forums/index.php?topic=101716.msg434300#msg434300, as the procedure is fairly similar on VPS and DedicatedServers, giving that we've completely phased out Virtuozzo now.

As some of you know, PHP 5.6, which appears to be one of the most commonly used versions of the popular interpreter, is now End of Life, which means it will no longer be supported and a security concern going forward. Because of this, the recommendation is to consider switching as soon as possible to a supported version (you can see the valid releases at any point at https://secure.php.net/supported-versions.php).
The following wiki assumes you have previously logged in via SSH to manage your VPS/Dedicated machine - if you have not, I strongly suggest considering one of our Managed Hosting plans plan (details at https://lunarpages.com/web-hosting/addons/managed-hosting-services/), where we will handle updates such as this one for you. Ensure that all the applications you host are fully compatible with the release you're planning to add, since reverting back will be almost impossible due to multiple dependencies that will need to be fixed - most of the recent applications support both PHP 7.2 and PHP 7.3; if you're on something that is a couple of years old, you've got even more security concerns and we'd strongly advise switching to applications that are actively maintained and fully updated.

You will need root permissions to perform the update, which will go through as follows, irrespective of whether you're on a VPS or a Dedicated server at this point:

1) For CPanel servers, you will need to switch to EasyApache 4 (https://documentation.cpanel.net/display/EA4/How+to+Install+or+Uninstall+EasyApache+4 and also see https://www.lunarpages.com/forums/index.php?topic=101695.0.) if you haven't done it by now; if you are already on EasyApache4, you can scroll for the upgrade procedures. For safety, you can save the output of "php -m", just in case you need additional PHP modules. You can either update EasyApache from WHM -> EasyApache, or from SSH as follows:

Code: [Select]
/scripts/migrate_ea3_to_ea4 --run
yum -y erase ea-apache24-mod_ruid2
yum -y install ea-apache24-mod_lsapi liblsapi liblsapi-devel ea-apache24-mod_suexec ea-apache24-mod_suphp
mkdir -p /etc/cpanel/ea4/profiles/custom/
nano /etc/cpanel/ea4/profiles/custom/lp.json

and then create the JSON file with the versions you need; you can specify multiple packages (i.e. both PHP 7.2 and PHP 7.3) in here, then you'll be able to assign these on a per-domain basis from CPanel's MultiPHP Manager:
Code: [Select]
{
   "pkgs" : [
      "ea-apache24",
      "ea-apache24-config",
      "ea-apache24-config-runtime",
      "ea-apache24-mod_bwlimited",
      "ea-apache24-mod_cgi",
      "ea-apache24-mod_cloudflare",
      "ea-apache24-mod_dav",
      "ea-apache24-mod_mime_magic",
      "ea-apache24-mod_deflate",
      "ea-apache24-mod_expires",
      "ea-apache24-mod_headers",
      "ea-apache24-mod_hostinglimits",
      "ea-apache24-mod_mpm_prefork",
      "ea-apache24-mod_proxy",
      "ea-apache24-mod_proxy_fcgi",
      "ea-apache24-mod_proxy_http",
      "ea-apache24-mod_security2",
      "ea-apache24-mod_ssl",
      "ea-apache24-mod_substitute",
      "ea-apache24-mod_suexec",
      "ea-apache24-mod_suphp",
      "ea-apache24-mod_unique_id",
      "ea-apache24-tools",
      "ea-apr",
      "ea-apr-util",
      "ea-cpanel-tools",
      "ea-documentroot",
      "ea-libmcrypt",
      "ea-modsec-sdbm-util",
      "ea-php-cli",
      "ea-php72",
      "ea-php72-libc-client",
      "ea-php72-pear",
      "ea-php72-php-bcmath",
      "ea-php72-php-bz2",
      "ea-php72-php-calendar",
      "ea-php72-php-cli",
      "ea-php72-php-common",
      "ea-php72-php-curl",
      "ea-php72-php-dba",
      "ea-php72-php-devel",
      "ea-php72-php-exif",
      "ea-php72-php-fpm",
      "ea-php72-php-ftp",
      "ea-php72-php-gd",
      "ea-php72-php-gettext",
      "ea-php72-php-imap",
      "ea-php72-php-intl",
      "ea-php72-php-iconv",
      "ea-php72-php-ioncube10",
      "ea-php72-php-litespeed",
      "ea-php72-php-mbstring",
      "ea-php72-php-mcrypt",
      "ea-php72-php-mysqlnd",
      "ea-php72-php-odbc",
      "ea-php72-php-pdo",
      "ea-php72-php-pgsql",
      "ea-php72-php-posix",
      "ea-php72-php-pspell",
      "ea-php72-php-soap",
      "ea-php72-php-sockets",
      "ea-php72-php-xml",
      "ea-php72-php-xmlrpc",
      "ea-php72-php-zip",
      "ea-php72-runtime"
   ],
   "version" : "1.0",
   "tags" : [
      "Apache 2.4",
      "PHP 7.2"
   ],
   "desc" : "Auto Generated profile",
   "name" : "lp.json"
}

then:
Code: [Select]
ea_install_profile --install /etc/cpanel/ea4/profiles/custom/lp.jsonand after this completes:
Code: [Select]
/usr/local/cpanel/bin/rebuild_phpconf --default=ea-php72 --ea-php72=suphpor
Code: [Select]
/usr/local/cpanel/bin/rebuild_phpconf --default=ea-php73 --ea-php72=suphp -ea-php73=suphpif you added PHP 7.3 too.
then:
Code: [Select]
/usr/local/cpanel/bin/rebuild_phpconf --current
should output the selected version(s).

That is it! What's even greater is that, from now on, CPanel will automatically update Apache and PHP for you (within the installed release trees, however) via its cron, which runs daily.


2) For Plesk servers, you will first need to ensure you're running an updated version. Details on how to do this can be found through their support pages (https://support.plesk.com/hc/en-us/articles/213408749-How-to-upgrade-Plesk-to-the-next-release-); it's there where you can get updated methods for PHP upgrades too - such as the one that's currently valid from https://support.plesk.com/hc/en-us/articles/115000769793-How-to-install-remove-additional-PHP-versions-provided-by-Plesk:
Code: [Select]
plesk installer --select-release-current --show-components
plesk installer --select-release-current --install-component php7.2
plesk installer --select-release-current --remove-component php5.6
service httpd restart


3) For LPCP servers, you will need to install the remi and epel repositories. CentOS6 (running "cat /etc/redhat-release" will show your actual OS version) customers will need to do
Code: [Select]
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh remi-release-7.rpm epel-release-latest-7.noarch.rpm


while CentOS7 customers can simply add the repository via yum:
Code: [Select]
yum install epel-release
then:
Code: [Select]
yum install yum-utils
yum-config-manager --enable remi-php72
yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo php-mbstring php-xml php-xmlrpc php-zip
service httpd restart
(you can follow the same format to install additional PHP extensions)


You can then load a phpinfo(); page to confirm that the update went through as expected and that your domain name uses the updated release.

Please let us know if you have any questions, concerns or suggestions. If you do get stuck, you can contact our team at any point at dedicated@lunarpages.com.


Thank you.
« Last Edit: January 18, 2019, 02:49:53 AM by AdrianAvadani »
Adrian Avadani
System Administrator Team

Telephone: 1-714-521-8150
Fax: 1-714-521-8195