Is this Nethserver module helpful to you?
Please consider donating to the author

Thank you kindly!

2019/03/04 11:32 · HF

PHP by software collections

Available NS6 and NS7

Nethserver is a distro based on Centos which have a php version not easy to upgrade, or really not recommended to do. This rpm which will install beside the default version all needed rpm from remi repository to use other versions of PHP.

This module provides a support to install php-scl from remi repository inside nethgui,remi repository is the laboratory before to send the rpm to the software collection of redhat.

Actually the virtualhosts panel of cockpit allows to switch the php version too, it uses the rh-php from the software collection of redhat. It is the stable version.

php73 of remi !== rh-php73 of redhat

The two uses different TCP port, the two uses different unix socket, the two are different software.

This module won't be updated the official way now is cockpit with the virtualhosts panel

Stephane de Labrusse at stephdl@de-labrusse.fr

NS6

php54, php55, php56, php70

NS7

php56, php70, php71, php72, php73

  • Stephdl Repo

First you need to install my repository, see how to do it

  • Install EPEL Repo
  yum localinstall http://ftp.heanet.ie/pub/fedora/epel/6/i386/epel-release-6-8.noarch.rpm

Disable it:

eorepo centos-base centos-updates nethserver-base nethserver-updates nethforge
  • Install the remi repository
  yum install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
  • Install the module
yum install nethserver-php-scl --enablerepo=stephdl,epel,remi-safe
  • Stephdl Repo

First you need to install my repository, see how to do it

  • Install the remi repository
  yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
  • Install the module
  yum install nethserver-php-scl --enablerepo=stephdl,remi-safe

Normally the Panel should be complete and you should not use the command Line, if you think that we can enhance the PHP settings by bringing more options, please ask.

the settings are in two places

  • in the Shared Folder (NS6)

Here you can decide which version you will use for the Ibay/virtualhost (default means the php version of Apache). Since we use a CGI script to handle the php version, you won't be able to trigger php settings with the module nethserver-phpsettings, you have to adjust settings by the relevant php.ini. I wanted to code something cool so all settings are not db command based….I bring a panel…you must go to the 'Php Settings' in the configuration panel.

* in the Shared Folder (NS7)

please upgrade to NS7, here now you run a dedicated instance of phpscl for each Vhost and obviously we can set specific values to this vhost

  • In the Php Settings Panel (NS6)

Here you can decide which version you want to use for the whole server. When Apache is the Handler of Php then you can trigger php settings with my other module nethserver-phpsettings. In other word if you want to use the module nethserver-phpsettings and you need a specific version of Php, you must use that version for the whole Server. Of course you can go back to the default version if something goes wrong with an old web application.

  • In the Php Settings Panel (NS7)

Here you can decide which version you want to use for the default /var/www/html. Of course you can go back to the default version if something goes wrong with an old web application.

In other parts of the Panel you can adjust php settings to all different versions of Php, even the Php53 default centos version.

All php versions come from the remi repository and are installed in the /opt.

  • NS6

We use for NS6 the remi-safe repository, it means that it is enabled by default, do simply 'yum update' in your terminal.

  • NS7

We use for NS7 the remi-safe repository, it means that it is enabled by default, do simply 'yum update' in your terminal.

All php rpm must be installed directly from Remi by a yum command line(think that you might need to enable epel).
For example if you want to display all available rpm for the software collection

  • NS6
  yum list available php\* --disablerepo=* --enablerepo=remi-safe

If you want to install a rpm for all php version (php54,php55,php56,php70)

yum install php54-php-dba php55-php-dba php56-php-dba php70-php-dba --enablerepo=epel
  • NS7
  yum list available php\* --disablerepo=* --enablerepo=remi-safe

If you want to install a rpm for all php version (php56,php70,php71,php72,php73)

  yum install php56-php-dba php70-php-dba php71-php-dba php72-php-dba php73-php-dba

* with NS6

For php70 and php71 if you use php70 or php71 as the default php version (apache handler), you cannot use another version for an Ibay, the default will be forced to php70 or php71 even if you make another choice in the Ibay panel.

This is done because you have an incompatibility between mod_php5 and mod_php7

NOT RELEVANT FOR NS7

The php.ini must be adjusted by a custom-template else the next update of the rpm will erase your changes.

* for ns6 you will find the templates at :

/etc/e-smith/templates/opt/remi/php54/root/etc/php.ini/
/etc/e-smith/templates/opt/remi/php55/root/etc/php.ini/
/etc/e-smith/templates/opt/remi/php56/root/etc/php.ini/
/etc/e-smith/templates/etc/opt/remi/php70/php.ini/
/etc/e-smith/templates/etc/opt/remi/php71/php.ini/

* for ns7 you will find the templates at :

/etc/e-smith/templates/opt/remi/php56/root/etc/php.ini/
/etc/e-smith/templates/etc/opt/remi/php70/php.ini/
/etc/e-smith/templates/etc/opt/remi/php71/php.ini/
/etc/e-smith/templates/etc/opt/remi/php72/php.ini/
/etc/e-smith/templates/etc/opt/remi/php73/php.ini/

then issue in the terminal after you have created your custom-template

signal-event nethserver-php-scl-update

with ns7 you can adjust directly some parameters by creating a file, for example if you have created a virtualhost called wordpress, then you will find all the configuration at `/etc/opt/remi/php73/php-fpm.d/php-fpm.wordpress.conf`

I propose you create a file `/etc/opt/remi/php73/php-fpm.d/z_php-fpm.wordpress.conf`, you can put here all your settings

[wordpress]
php_admin_value[max_input_vars] = YourValue

then restart the service

systemctl restart php73-php-fpm

Keep in mind to modify the path of the file if you change the version of php `/etc/opt/remi/php73/php-fpm.d/z_php-fpm.wordpress.conf` to `/etc/opt/remi/php74/php-fpm.d/z_php-fpm.wordpress.conf`

- Adapt the path to your relevant php version

/opt/remi/php71/root/usr/bin/php --version

- If you want to start the software collection after the server reboot, please be aware that you could make issues with softwares not compatible with the software collection version.

Please read the Redhat certified solution.

With that package, you can enable userspace environment automatically by creating a new file under /etc/profile.d with the following content (example for php72 collection): Raw

$ cat /etc/profile.d/enablephp72.sh
#!/bin/bash
source scl_source enable php72

With such file all users will have php72 collection enabled by default in shell.

Please raise Issues on github