Here is a simple lamp install script for CentOS 8.

#!/bin/bash
#update system
dnf update
#install apache
dnf install httpd httpd-tools -y
systemctl enable httpd
systemctl start httpd
systemctl status httpd
#update firewall
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
#install mariadb
dnf install mariadb-server mariadb -y
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
mysql_secure_installation
# Install PHP 7 on CentOS 8
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
#dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm
#dnf module list php
dnf install php php-opcache php-gd php-curl php-mysqlnd -y
systemctl start php-fpm
systemctl enable php-fpm
systemctl status php-fpm
setsebool -P httpd_execmem 1
systemctl restart httpd

Check the installation

# nano /var/www/html/info.php

Insert the PHP code below and save the file.


[/bash]
Then head out to your browser, and type the URL below. Remember to replace the server IP address with your server’s actual IP address.

http://server-ip-address/info.php

Recently there was an issue where the fopen and curl function and shell_exec functions were reverting back to original values. Using the MutiPHP Editor was not working.

the resolution was that the php-fmp handler was being used on a cpanel server. So the php-fpm config file needed to be changed.

The line that needs to be edited is:in /opt/cpanel/ea-php56/root/etc/php-fpm.d/$DOMAIN

Remove the disable_functions which includes shell_exec

php_admin_value[disable_functions] =

Then restart the following services.

systemctl restart httpd.service
/scripts/restartsrv_apache_php_fpm
/scripts/restartsrv_cpanel_php_fpm

UPDATE; Seems the yaml files need to be updated:
https://forums.cpanel.net/threads/stop-cpanel-from-overwriting-php-fpm-settings-file.596527/

This information is for editing the yaml file which should result in permanent changes.

More information here on php-fpm configurations:
https://documentation.cpanel.net/display/64Docs/Configurations+Values+of+PHP-FPM#ConfigurationsValuesofPHP-FPM-Howtoremovedefaultvaluesfromaconfiguration

UPDATE 2:

Also, there was an issue with fopen where the changes in the MultiPHP Editor were being overwritten.

If  PHP handler is LSAPI, you can adjustment to your Apache configuration. Please ensure the setting is enabled for the site(s) in question under MultiPHP Ini Editor. If this still does not work, in whm from   Home »Software »MultiPHP Manager there is a System PHP-FPM Configuration tab and from it you can change the user override ability for allow_url_fopen and other options.

 

When needing to run a command in a different version on php.
Where is the path to php 7 on cpanel?


# /opt/cpanel/ea-php70/root/usr/bin/php -v
PHP 7.0.32 (cli) (built: Sep 14 2018 20:36:03) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

How to specify command line command “php” version for SSH user on the Plesk server?

/opt/plesk/php/7.2/bin/php -v 

See: https://support.plesk.com/hc/en-us/articles/115003766853-How-to-specify-PHP-version-on-the-Plesk-server-for-command-line-command-php-for-user-
set the path – https://stackoverflow.com/questions/31206864/use-different-php-version-cli-executable-for-one-command

Check settings in plesk: Tools and Settings > General > PHP Settings. Click on a php version:

Through the OS vendor (CentOS 7 PHP 5.4.16 OS Vendor)

Connect to the server via SSH;

Install the pre-compiled extension packages: .rpm-based distribution (CloudLinux, CentOS, RHEL):

# yum install -y epel-release
# yum install -y php-pecl-ssh2

.deb-based distribution (Debian, Ubuntu):

# apt install -y php-ssh2

Restart apache:

# service httpd restart

Reload the handler

# plesk bin php_handler --reread

You can check with php -m

# php -m
ssh2

Check with php info file:

Check command line:

# php -i | grep ssh2
/etc/php.d/ssh2.ini,
Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp, zip
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
libSSH Version => libssh2/1.4.3
ssh2
libssh2 version => 1.4.3
banner => SSH-2.0-libssh2_1.4.3

Check in Plesk. Tools and Settings > General > PHP Settings > Click on 5.4.16 by OS vendor FPM application

Plesk PHP 5.6

Install Development packages:

# yum install plesk-php56-devel gcc libssh2-devel

Install all ssh2:

# /opt/plesk/php/5.6/bin/pecl install ssh2-0.13

Register extension in configuration file:

# echo "extension=ssh2.so" > /opt/plesk/php/5.6/etc/php.d/ssh2.ini

Update PHP handlers information:
# plesk bin php_handler --reread
The information about PHP handlers was successfully updated.

Restart PHP-FPM:
Find the plesk version:

#  plesk bin php_handler --list | grep -E plesk.*fpm | awk -F" " '{ print $1 }'
plesk-php56-fpm
plesk-php70-fpm
plesk-php71-fpm
plesk-php72-fpm

Restart the applicable servie for your environment, In this case, plesk-php56-fpm

# service plesk-php56-fpm restart

You can check with a phpinfo file here:

Plesk PHP 7.0 and Above

Note: In following instructions ‘7.0’ should be replaced with ‘7.1’ to install the extension for PHP 7.1.
Connect to the server via SSH

Install all required packages: .rpm-based distribution (CloudLinux, CentOS, RHEL):

Note: Following steps describe the installation of developer packages for PHP 7.0. For PHP 7.2, for instance, plesk-php72-devel or plesk-php72-dev must be installed.

# yum install -y plesk-php70-devel gcc libssh2-devel

.deb-based distribution (Debian, Ubuntu):

# apt install -y plesk-php70-dev gcc libssh2-1-dev

Build the extension:
Install the extension:

# /opt/plesk/php/7.0/bin/pecl install ssh2-1.1.2
downloading ssh2-1.1.2.tgz ...
Starting to download ssh2-1.1.2.tgz (32,057 bytes)
.........done: 32,057 bytes
6 source files, building
running: phpize
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012
libssh2 prefix? [autodetect] :

Hit enter and you should see he the build successful

building in /tmp/pear-build-rootSbcR3r/ssh2-1.1.2
running: /tmp/ssh2/configure --with-php-config=/opt/plesk/php/7.0/bin/php-config --with-ssh2
checking for grep that handles long lines and -e... /usr/bin/grep
......

Build process completed successfully
Installing '/opt/plesk/php/7.0/lib64/php/modules/ssh2.so'
install ok: channel://pecl.php.net/ssh2-1.1.2
configuration option "php_ini" is not set to php.ini location
You should add "extension=ssh2.so" to php.ini
...

Register extension in configuration file:

# echo "extension=ssh2.so" > /opt/plesk/php/7.0/etc/php.d/ssh2.ini

Update PHP handlers information:

# plesk bin php_handler --reread
The information about PHP handlers was successfully updated.

Restart PHP-FPM:

# service plesk-php70-fpm restart

Now you can go to Tools and Settings > General > PHP Settings > 7.0.32 FPM application (or any of the activated 7.0.32 links). And you should see:

Other sources:
https://support.plesk.com/hc/en-us/articles/213930085-How-to-install-SSH2-extension-for-PHP-
https://www.simplecloudhosting.net/cloud/index.php?rp=/knowledgebase/47/How-to-Install-the-PHP-SSH2-Extension.html

After an upgrade from PHP 5.4 to 5.6, I received an error when I run an app update:

Your requirements could not be resolved to an installable set of packages.
Problem 1 – This package requires php >=5.6 but your PHP version (5.4.45) does not satisfy that requirement.

Issue:

The shell cli is currently running on php5.4. You will need to specify what version the shell will use. This can be done by running the following command.


# echo "alias php='/opt/plesk/php/5.6/bin/php'" >> ~/.bashrc

The guide from Plesk

https://support.plesk.com/hc/en-us/articles/115003766853-How-to-specify-PHP-version-on-the-Plesk-server-for-command-line-command-php-for-user-

You can confirm here:


# php -v
PHP 5.6.35 (cli) (built: Mar 30 2018 12:52:22)
Copyright (c) 1997-2016 The PHP Group

How to replace php 5.4 with php 5.6.

Before installing PHP 5.6, apply any existing updates available for your distribution:


# yum check-update
# yum update

Also, this is a good moment to get (and save somewhere) a list of our installed packages (in case we need to rollback):


# rpm -qa |grep php
php-mbstring-5.4.16-36.1.el7_2.1.x86_64
php-mysql-5.4.16-36.1.el7_2.1.x86_64
(...)
php-gd-5.4.16-36.1.el7_2.1.x86_64
php-odbc-5.4.16-36.1.el7_2.1.x86_64

Download and install the “repos” package:

# wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm


# rpm -Uhv remi-release-7.rpm

Now enable the repository in Yum by setting enable=1 for the remi-php56 repo:


# nano /etc/yum.repos.d/remi.repo
(...)

[remi-php56]
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 7 - $basearch
mirrorlist=http://rpms.remirepo.net/enterprise/7/php56/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

(...)

Replace PHP 5.4 with PHP 5.6
Install the packages not as a Software Collection but as “Replacement Packages”:

# yum update

This yum update command should upgrade all our PHP packages. If it does not upgrade them or we don’t have PHP already installed, then do:

# yum --enablerepo=remi-php56 install php-cli

Yum will remove the old packages and install the new ones.

Now, restart services:


# systemctl restart httpd
# systemctl restart nginx
# systemctl restart php-fpm

if you receive an Nginx error, then you may need to reconfigure it. See: https://geekdecoder.com/install-nginx-centos-7/

On systems that run EasyApache 3, the /usr/local/lib/ directory contains your server’s php.ini file.
On systems that run EasyApache 4, multiple php.ini and local.ini files manage your system’s PHP. Each version of PHP on your systems uses its own php.ini and local.ini file. You must make changes to each file separately.

On systems that run EasyApache 3, we strongly recommend that you only edit this file with WHM’s PHP Configuration Editor interface (Home >> Service Configuration >> PHP Configuration Editor).

On systems that run EasyApache 4, we strongly recommend that you only edit these files with WHM’s MultiPHP INI Editor interface (Home >> Software >> MultiPHP INI Editor). This ensures that an operable version of PHP exists on the system.

Resource: https://documentation.cpanel.net/display/CKB/How+to+Edit+Your+php.ini+File