User Tools

Site Tools


plugins:phpswitcher

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
plugins:phpswitcher [2017/08/09 01:54]
nuxwin
plugins:phpswitcher [2019/09/28 11:11]
nuxwin
Line 1: Line 1:
-<​markdown>​ 
-# i-MSCP PhpSwitcher plugin 
-</​markdown>​ 
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Bear in mind that this documentation is for the last available ​version. If you use an older version, you must refer to the README.md file inside the plugin archive.**+**Bear in mind that this documentation is for the lastest PhpSwitcher plugin ​version. If you use an older version, you must refer to the README.md file inside the plugin archive.**
 </​WRAP>​ </​WRAP>​
 <​markdown>​ <​markdown>​
-## Introduction+i-MSCP PhpSwitcher plugin v5.0.0
  
 Provides additional PHP versions for customers. Provides additional PHP versions for customers.
Line 12: Line 9:
 ## Requirements ## Requirements
  
-- i-MSCP Serie ≥ 1.4.x +- One of the [supported distributions](#​supported_distributions) 
-Either the Fcgid or the PHP-FPM Apache2 ​httpd server implementation+- i-MSCP Serie ≥ 1.5.3 
 +The Fcgid or the FPM i-MSCP ​httpd server implementation
  
-You can switch between HTTPD server implementations by executing the following +### Supported distributions
-commands:+
  
-``` +- Debian Jessie 8.x, Debian Stretch 9.x, Debian Buster 10.x  
-cd <​path_to_your_imscp_archive>​ +- Ubuntu Xenial Xerus 16.04, Ubuntu Bionic Beaver 18.04  
-perl imscp-autoinstall -dar httpd +Devuan Jessie 1.x, Devuan ASCII 2.x 
-```+ 
 +### Recommendations
  
-Note that when asked, it is recommended to choose ​the `per_sitePHP +Recommended use of this plugin ​is with the i-MSCP FPM httpd server in **UDS** 
-configuration level. This allow your customers to choose a different PHP +mode, and with the **per_site** PHP configuration level.
-versions for any of sites.+
  
 ## Installation ## Installation
  
-1. Be sure that all requirements ​as stated in the requirements section ​are met+1. Be sure that all requirements are met
 2. Upload and install the plugin through the plugin management interface 2. Upload and install the plugin through the plugin management interface
-3. Compile and install your PHP versions (see below to know how) +3. Compile, install ​and/or register ​your PHP versions
-4. Setup your PHP versions ​(see below to know how)+
  
 ## Update ## Update
  
-1. Read the UPDATE file inside the plugin archive +1. Read the UPDATE.md file inside the plugin archive 
-2. Be sure that all requirements ​as stated in the requirements section ​are met+2. Be sure that all requirements are met
 3. Upload the plugin through the plugin management interface 3. Upload the plugin through the plugin management interface
-4. Re-compile ​your PHP versions ​if needed (see the doc/​graceful_update.md file)+4. Compile, install and/or register ​your PHP versions ​
  
 ## Glossary ## Glossary
Line 45: Line 41:
 In the documentation below, the following variables are used: In the documentation below, the following variables are used:
  
-- %version% ​   : One of available PHP version such as 4.45.2, 5.4 ... +- %version% ​   : One of available PHP version such as 7.17.2, 7.3, 7.4 ... 
-- %ymd%        : The date of the day such as 20170306+- %ymd%        : The date of the day such as 20190831
 - %installdir% : Installation directory such as /​opt/​phpswitcher/​20170306 - %installdir% : Installation directory such as /​opt/​phpswitcher/​20170306
  
-## Compiling and installing ​PHP versions+## Compiled ​PHP versions
  
-This plugins comes with a Perl scriptthat is able to downloads, configures+This plugin provides the `php_compiler.pl` ​script that cancompile and install 
-compiles and installs ​additional PHP versions in one step, without any human +additional PHP versions in one step. It can also register them in the 
-interaction. It can also automatically setup PHP versions.+Phpswitcher plugin.
  
-For instance, if you want to install all available ​PHP versions, you can +For example, if you want to compile and install all additional ​PHP versions, you 
-execute the following command:+can execute the following command:
  
-``` +```shell 
-cd /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler +# perl /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler/php_compiler.pl
-perl php_compiler.pl ​all+
 ``` ```
  
-or if you want to install ​one or many specific PHP versions, you can execute +or if you want to install specific PHP versions:
-the following command:+
  
-``` +```shell 
-cd /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler +# perl /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler/php_compiler.pl %version% %version%
-perl php_compiler.pl %version% %version%+
 ``` ```
  
-You can also ask the compiler to automatically ​setup the PHP versions by adding +You can also automatically ​register ​the PHP versions ​in the PhpSwitcher plugin 
-the `--auto-setupcommand line option. For instance:+by passing ​the `--register` option. For instance:
  
-``` +```shell 
-cd /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler +# perl /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler/php_compiler.pl --register ​%version% %version%
-perl php_compiler.pl --auto-setup ​%version% %version%+
 ``` ```
  
-This will automatically configure, build, install and setup the specified PHP +Doing this avoid the need to register them manually through the PhpSwitcher 
-versions. ​Doing this avoid the need to setup all PHP versions ​manually through +plugin ​administration interface.
-the PhpSwitcher administration interface. +
- +
-To get list of all available command line options, you can execute the +
-following command: +
- +
-``` +
-cd /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler +
-perl php_compiler.pl --help +
-```+
  
 ### Supported PHP versions ### Supported PHP versions
  
-Supported ​PHP versions ​depend ​on the i-MSCP httpd server implementation in use.+The supported ​PHP versions ​are the last that were available when this plugin 
 +version has been released. This means that by default, the versions provided by 
 +the `php_compiler.pl` script can be lower than the last that were released ​on 
 +the PHP site.
  
-If you use the Fcgid Apache2 i-MSCP httpd server implementation,​ the following +Supported ​PHP versions are: `5.3` up-to `7.4`
-PHP versions are supported`4.4`, `5.2`, ​`5.3``5.4`, `5.5`, `5.6`, `7.0` and +
-`7.1`.+
  
-If you use the PHP-FPM Apache2 i-MSCP httpd server implementation,​ the +#### Forcing ​the `php_compiler.plscript to download latest PHP sources
-following PHP versions are supported: ​`5.3`, `5.4`, `5.5`, `5.6`, `7.0` and +
-`7.1`.+
  
-Note that the supported PHP versions are the last that were available when this +You can ask the `php_compiler.pl` script ​to download ​latest ​PHP sources ​by 
-plugin version has been released. This means that by default, the versions +passing ​the `--force-last` option. However, you must bear in mind that some 
-provided by the PHP compiler ​can be lower than the last that were released on +patches might not longer apply, in which case you should report us the failure 
-the PHP siteIn such case, you can ask the PHP compiler ​to download ​the last +message by creating a new issue on our bug tracker.
-available ​PHP version ​by adding ​the `--force-last` ​command line option.+
  
-However, you must be aware that some patches could not longer apply on these +### Download directory
-versions. If so, you should report us the failure message by creating a new +
-issue on our bug tracker.+
  
-### Build and installation directories+By default, the PHP sources are downloaded in the `/​usr/​local/​src/​phpswitcher` 
 +directory. You can override the default download directory by passing the 
 +`--download-dir` option to the `php_compiler.pl` script.
  
-By default the new PHP versions are build into the +### Build directory
-`/​usr/​local/​src/​phpswitcher/​php%version%` ​directory, and installed in the +
-`/​opt/​phpswitcher/​%ymd%/​php%version%` directory but you can change this +
-behavior with the `--install-dir` command line option.+
  
-### SSL support for PHP 4.4+By default, the compiled ​PHP versions are build in the 
 +`/​usr/​local/​src/​phpswitcher/​php%version%` directory. You can override the 
 +default build directory by passing the  `--build-dir` option to the 
 +`php_compiler.pl` script.
  
-PHP 4.4 is built against a bundled OpenSSL (openssl-0.9.8).+### Installation directory
  
-### SSL support for PHP ≥ 4.4 but < 5.6+By default, the compiled ​PHP versions are installed in the 
 +`/​opt/​phpswitcher/​%ymd%/​php%version%` directoryYou can override the 
 +default installation directory by passing the  `--install-dir` option to the 
 +`php_compiler.pl` script.
  
-For systems ​on which OpenSSL library is greater or equal to 1.1.0, ​PHP versions +### Changes made on PHP sources
-greater than 4.4 but older than 5.6 are built against a bundled OpenSSL +
-(1.0.2l).+
  
-### Changes made on PHP versions +set of patches is applied on PHP sources ​before ​configuring ​them. The patches 
- +include the following changes:
-PHP versions provided by the PHP compiler are almost identical to those that +
-are provided by the Debian team. For each PHP version, a set of patches is +
-applied on PHP upstream source ​before ​compiling ​them. The patches include the +
-following changes:+
  
 - Multiarch support - Multiarch support
-Usage of system libtool instead of the bundled ​version ​(whenever possible)+Support for latest OpenSSL 1.1.x version
 - Any patch that fix a bug, a security issue or a FTBFS issue - Any patch that fix a bug, a security issue or a FTBFS issue
  
-Most of the patches were pulled from the Debian PHP source packages ​and +Most of the patches were pulled from the Debian PHP team git repository ​and 
-adjusted ​when needed, while some other were created to resolve FTBFS issues ​or +modified ​when needed, while some other were created to resolve FTBFS issues. 
-adjust configuration. Patches which were not pulled from Debian PHP source +Patches which were not pulled from Debian PHP team git repository ​have the 
-packages ​have the `nxw_` prefix in their names.+`nxw-` prefix in their names.
  
-### Available ​PHP extensions+### PHP extensions
  
-Available ​PHP extensions are the same that are enabled in PHP versions ​provided +PHP extensions are the same that are provided by PHP versions ​from the Debian 
-by Debian/​Ubuntu ​team. However, it must be noted that some of them can have been +PHP team. Most are compiled as shared module.
-disabled for some PHP versions due to incompatibilities with system libraries +
-that are too recent.+
  
-Most of PHP extensions are compiled as shared module.+### PHP build dependencies (since version 5.0.0)
  
-### Build dependencies+The `php_compiler.pl` script install the build dependencies ​for you by creating 
 +a specific Debian dependency package for each PHP version. These  packages are 
 +purged after a successfull build.
  
-The PHP compiler installs the build dependencies ​for youHowever, if a package +### PHP runtime ​dependencies ​(since version 5.0.0)
-isn't available, it will go ahead and the PHP configuration process will fail.+
  
-### Parallel Execution (GNU make)+The `php_compiler.pl` script install the PHP runtime dependencies for you by 
 +creating a specific Debian runtime dependency package for each PHP version. 
 +These packages are purged only when you uninstall the plugin.
  
-For faster compilation,​ the parallel execution feature provided by GNU make is +### Build environment (since version 5.0.0)
-enabled whenever possibleThis feature allows to execute many recipes +
-simultaneouslyBy default, the number of parallel jobs is set according the +
-number of CPU core available on your system. You can still set the value +
-manually with the `--parallel-jobs` command line option as follow:+
  
-``` +Build perations are performed in a chroot environment by default. This allows to 
-cd /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler +setup a clean build environment,​ and this also avoid to pollute the production 
-perl php_compiler.pl --parallel-jobs 1 %version% +system with PHP build dependencies.
-```+
  
-Here, only one recipe will be run at time.+You can switch back to the historical behavior by passing the `--no-chroot` 
 +option to the `php_compiler.pl` script.
  
-See https://​www.gnu.org/​software/​make/​manual/​html_node/​Parallel.html for +### Parallel ​Execution (GNU make)
-further details about this feature.+
  
-### Installation layout+For faster compilation,​ the parallel execution feature provided by GNU make is 
 +enabled. This feature allows to execute many recipes simultaneously. By default, 
 +the number of parallel jobs is set according the number of CPU core available on 
 +your system + 1. You can still set the value manually by passing the 
 +`--parallel-jobs` ​ option to the `php_compiler.pl` script.
  
-First of all, you must note that in all cases, we build the following PHP +See [Parallel Execution](https://www.gnu.org/​software/​make/​manual/​html_node/​Parallel.html) 
-SAPIs`cli`, `cgi` and `fpm`This allows switching on other i-MSCP httpd +for further details about this feature
-server implementation without having to rebuild all PHP versionsThis is also + 
-needed to build static phpinfo filesIndeed, we always use the PHP FastCGI +### Installation layout
-binary to build them.+
  
 For all PHP versions provided by the PHP compiler, the following installation For all PHP versions provided by the PHP compiler, the following installation
Line 203: Line 180:
 - User php.ini files: /​var/​www/​fcgi/​%domain%/​php%version%/​php.ini - User php.ini files: /​var/​www/​fcgi/​%domain%/​php%version%/​php.ini
  
-#### PHP fpm SAPI (only when available)+#### PHP fpm SAPI
  
 - PHP-FPM binary: /​opt/​phpswitcher/​%ymd%/​php%version%/​sbin/​psw%version%-fpm - PHP-FPM binary: /​opt/​phpswitcher/​%ymd%/​php%version%/​sbin/​psw%version%-fpm
 - PHP-FPM configuration file: /​opt/​phpswitcher/​%ymd%/​php%Version%/​etc/​php-fpm.conf - PHP-FPM configuration file: /​opt/​phpswitcher/​%ymd%/​php%Version%/​etc/​php-fpm.conf
-- PHP-FPM checkconf script: /​usr/​local/​lib/​phpswitcher/​psw%version%-fpm-checkconf 
 - PHP-FPM instance pid file: /​var/​run/​phpswitcher/​psw%version%-fpm.pid - PHP-FPM instance pid file: /​var/​run/​phpswitcher/​psw%version%-fpm.pid
 - PHP-FPM log file: /​var/​log/​phpswitcher/​psw%version%-fpm.log - PHP-FPM log file: /​var/​log/​phpswitcher/​psw%version%-fpm.log
Line 215: Line 191:
 - PHP-FPM tmpfile: /​etc/​tmpfiles.d/​psw%version%-fpm.conf - PHP-FPM tmpfile: /​etc/​tmpfiles.d/​psw%version%-fpm.conf
  
-As you can see, we use a specific naming convention for PHP-FPM. This is needed +As you can see, there is a specific naming convention for PHP-FPM. This is needed 
-to avoid conflict with PHP versions ​that are provided by your distribution.+to avoid conflict with packaged ​PHP versions.
  
 Note that the `psw` prefix stands for `PhpSwitcher`. Note that the `psw` prefix stands for `PhpSwitcher`.
  
-## PHP configuration+#### Static paths (since version 5.0.0)
  
-Before going further it is important to note that it is useless to edit any PHP +For convenience, ​the `php_compiler.plscript also creates symlinks to the 
-configuration file located under the `/​etc/​php%version%or +installation ​directories ​of various PHP versionswhich allows ​the sysadmin 
-`/​etc/​php/​%version%` ​directories. Indeed, the files located under these +to access ​the PHP binaries always ​by the same paths (e.g. in CRONTAB(5) files).
-directories are only relevant for the PHP versions provided ​by your +
-distribution.+
  
-For the same reasons, it is useless to try to enable/disable a PHP module using +These symlinks are created in the `/opt/​phpswitcher/​static` directory, either at 
-the command line tools phpenmod/​phpdismod that are provided by your distribution+the installation stage, or at the registration stageIf you do not want these 
-Those tools only operate on the INI files that are provided by your distribution.+symlinks, you can pass the `--no-static-paths` option to the `php_compiler.pl` 
 +script.
  
-### PEAR packages+Note that when the symlinks are available, they will be used for registration 
 +process in place of the default paths.
  
-Each PHP version comes with its own PEAR distribution ​that is installed under +## Packaged PHP versions (since version 5.0.0) 
-the `/​opt/​phpswitcher/​%ymd%/​php%version%/​share/​pear` directory. ​Please don't + 
-try to include PEAR library from another location without ​knowning ​what you are +The `php_compiler.pl` script also make possible to register packaged PHP 
-doing. Doing this could lead to serious problems.+versions in the PhpSwitcher plugin. Packaged PHP versions are either those 
 +provided by the Debian PHP team, or the Ondřej Surý repositories. To register 
 +the packaged PHP versions, you need to execute the following command: 
 + 
 +```shell 
 +# perl /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler/​php_compiler.pl --register --packaged 
 +``` 
 + 
 +When the `--packaged` option is passed-in, the `php_compiler.pl` script will 
 +favor registration of packaged PHP versions rather than compiled ones. In other 
 +words, for a given PHP version, the PHP compiler will fallback to a compiled PHP 
 +version only if there is no packaged PHP version available. 
 + 
 +If you only want work with packaged PHP versions, you can also pass the 
 +`--packaged-only` option: 
 + 
 +```shell 
 +# perl /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler/​php_compiler.pl --register --packaged --packaged-only 
 +``` 
 + 
 +With this option, only the packaged PHP versions will be considered, regardless 
 +of their availalibity. If no packaged PHP version is available, nothing will 
 +happend, that is, no fallback to a compiled PHP version will be made. 
 + 
 +You can of course still specify the PHP versions for which you want to operate 
 +on, and you can also change the default directory, where the PHP compiler is 
 +looking for the compiled PHP versions, by passing the `--install-dir` option. 
 +For instance: 
 + 
 +```shell 
 +# perl /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler/​php_compiler.pl --register --packaged --install-dir /​opt/​my/​install/​directory 7.1 7.3 7.4 
 +``` 
 + 
 +Note that for a packaged PHP version, the plugin backend will skip generation of 
 +most configuration files as those are already provided by the package. You need 
 +also remember that for a packaged PHP version, the FPM service name is 
 +`php%version%-fpm` instead of `psw%version%-fpm`. 
 + 
 +Finally, you need keep in mind that for the `php_compiler.pl` script, the 
 +packaged PHP versions are considered only when all requirements are met, that 
 +is, when for a given PHP version, the CGI sapi, FPM sapi, and the PEAR 
 +distribution are all installed on the system. For instance, if you want to 
 +register the PHP 7.3 packaged version, you must first make sure that all 
 +required distribution packages are installed:​ 
 + 
 +```shell 
 +# apt-get update 
 +# apt-get install php7.3-cli php7.3-cgi php7.3-fpm php-pear 
 +``` 
 + 
 +## PEAR packages 
 + 
 +### For a compiled PHP version 
 + 
 +Each compiled ​PHP version comes with its own PEAR distribution ​which is 
 +installed under the `/​opt/​phpswitcher/​%ymd%/​php%version%/​share/​pear` directory. 
 + 
 +You shouldn't try to include ​PEAR library from another location without 
 +knowing ​what you are doing because doing this could lead to an unexpected 
 +behavior.
    
 If you want to install additional PEAR packages, you must install them using If you want to install additional PEAR packages, you must install them using
-the `pear` command provided by the PHP version for which you want act. For +the `pear` command provided by the compiled ​PHP version for which you want act. 
-instance:+For instance:
  
 +```shell
 +# cd /​opt/​phpswitcher/​%ymd%/​php%Version%/​bin
 +# ./pear install Net_SMTP
 ``` ```
-cd /​opt/​phpswitcher/​%ymd%/​php%Version%/​bin + 
-./​pear ​install ​Net_SMTP+### For a packaged PHP version 
 + 
 +For a packaged PHP version, you just need to install ​the distribution package: 
 + 
 +```shell 
 +# apt-get update 
 +# apt-get install php-net-smtp
 ``` ```
  
-### PHP extensions+or if there is none, you can process as follows: 
 + 
 +```shell 
 +/​usr/​bin/​pear install Net_SMTP 
 +``` 
 + 
 +## PHP extensions 
 + 
 +### For a compiled PHP version
  
-For convenience,​ most of PHP extensions are compiled as shared modules. When +For convenience,​ most of PHP extensions are compiled as shared modules. When a 
-installing a new PHP version, ​the PHP compiler create ​a specific INI file that +compiled ​PHP version ​is being installed, a specific INI file that enable most of 
-enable most of available PHP extensions. By default, this file is located at+available PHP extensions ​is created. By default, this file is located at
 `/​opt/​phpswitcher/​%ymd%/​php%version%/​etc/​php/​conf.d/​modules.ini`. `/​opt/​phpswitcher/​%ymd%/​php%version%/​etc/​php/​conf.d/​modules.ini`.
  
-Here, a single INI file is used for ease. This is not like with your +Here, a single INI file is involved. This is not like with a packaged PHP 
-distribution PHP packages ​where an INI file is created for each PHP extension.+version ​where there is one INI file per extension.
  
-To enable/​disable a specific PHP extension, you must just edit the INI file and +To enable/​disable a specific PHP extension, you must just edit the modules.ini 
-then, restart the Web server or PHP-FPM instance, depending on the i-MSCP httpd +INI file and once done, restart the Web server or PHP-FPM instance, depending on 
-server implementation in use.+the i-MSCP httpd server implementation in use.
  
-### Pecl extensions+### For a packaged PHP version
  
-If you want install ​Pecl extension, you must not use the `pecl` or `phpize` +For packaged PHP version, you can enable/​disable the PHP extensions using the 
-commands that are shipped with your distribution. Instead, you must use the +phpenmod/​phpdismod command provided by your distribution.
-commands that are provided in the directory of the PHP version for which you +
-want act.+
  
-For instance, if you want install the `ImageMagick` Pecl extension you must do +## PECL extensions
-as follow:+
  
-``` +### For a compiled PHP version 
-apt-get update ​&& ​apt-get -y install libmagickwand-dev imagemagick + 
-cd /​opt/​phpswitcher/​%ymd%/​php%version%/​bin +If you want to install a PECL extension, you must not invoke the `peclor 
-./pecl install imagick +`phpize` commands that are provided by your distribution. Instead, you must 
-echo '​extension = imagick.so' ​>> /​opt/​phpswitcher/​%ymd%/​php%version%/​etc/​php/​conf.d/​modules.ini+invoke those that are provided by the compiled PHP version for which you want 
 +act. 
 + 
 +For instance, if you want to install the `Imagick` PECL extension you can 
 +process as follows: 
 + 
 +```shell 
 +apt-get update 
 +apt-get -y install libmagickwand-dev imagemagick 
 +/​opt/​phpswitcher/​%ymd%/​php%version%/​bin/​pecl install imagick 
 +echo '​extension = imagick.so'​ > /​opt/​phpswitcher/​%ymd%/​php%version%/​etc/​php/​conf.d/​imagick.ini
 ``` ```
  
-then, you must restart the Web server or PHP-FPM instance, depending on the+Finally, you must restart the Web server or PHP-FPM instance, depending on the
 i-MSCP httpd server implementation in use. i-MSCP httpd server implementation in use.
  
-### APCu extension+### For a packaged PHP version
  
-APCu is userland cache stripped of opcode caching that comes in replacement +For packaged ​PHP version, you just need to install ​the distribution package:
-of the APC extension. It is a good complement for PHP versions ≥ PHP 5.5 that +
-already provide an opcode cache through ​the OPcache extension.+
  
-If you want to install ​this extension for one of your PHP version, you can do +```shell 
-as follow+# apt-get update 
 +# apt-get ​install ​php%version%-imagick 
 +``` 
  
-``` +or if there is none, you can process as follows: 
-cd /​opt/​phpswitcher/​%ymd%/​php%version%/bin + 
-./pecl install channel://pecl.php.net/apcu-%apcu_version+```shell 
-PHP_EXT_DIR=$(/opt/phpswitcher/%ymd%/php%version%/​bin/​php-config ​--extension-dir) +# apt-get update 
-echo "extension = $PHP_EXT_DIR/​apcu.so" ​> /opt/phpswitcher/%ymd%/php%version%/etc/php/​conf.d/​02_apcu.ini+# apt-get -y install ​php%version%-dev libmagickwand-dev imagemagick 
 +# update-alternatives --set php /usr/bin/php%version
 +# update-alternatives --set phpize ​/usr/bin/phpize%version% 
 +# update-alternatives --set php-config /usr/​bin/​php-config%version% 
 +# pecl install imagick 
 +echo 'extension = imagick.so' ​> /etc/php/%version%/mods-available/imagick.ini 
 +# phpenmod -v %version% imagick
 ``` ```
  
-then, you must restart the Web server or PHP-FPM instance, depending on the+Finally, you must restart the Web serveror PHP-FPM instance, depending on the
 i-MSCP httpd server implementation in use. i-MSCP httpd server implementation in use.
  
-Note that the APcu version to install ​depends on your PHP version+You can uninstall ​the PECL extension by following the same procedure, replacing 
 +the pecl `install` command by the pecl `uninstall` command. However, you'll have 
 +to disable the module first. For instance:
  
-4.0.x for PHP 5.5.x and 5.6.x +```shell 
-5.1.x for PHP 7.0.x and PHP 7.1.x+# update-alternatives --set php /​usr/​bin/​php%version% 
 +# update-alternatives --set phpize /​usr/​bin/​phpize%version% 
 +# update-alternatives --set php-config /​usr/​bin/​php-config%version% 
 +# phpdismod -v %version% imagick 
 +# rm /​etc/​php/​%version%/​mods-available/​imagick.ini 
 +# pecl uninstall imagick 
 +```
  
-### IonCube loader+**WARNING:​** In both cases, you must not forget to reset the various 
 +alternatives to their previous values, as required by i-MSCP core:
  
-If you want to install this extension for one of your PHP version, you can do +```shell 
-as follow ​(example for the x86-64 ​version):+# PHP_VERSION=$(egrep '​^PHP_VERSION'​ /​etc/​imscp/​php/​php.data | sed -e '​s/​PHP_VERSION\s\+=\s\+\(.*\)/​\1/​g'​) 
 +# update-alternatives --set php /​usr/​bin/​php"​$PHP_VERSION"​ 
 +# update-alternatives --set phpize /​usr/​bin/​phpize"​$PHP_VERSION"​ 
 +# update-alternatives --set php-config /​usr/​bin/​php-config"​$PHP_VERSION"​ 
 +``` 
 + 
 +## IonCube loader 
 + 
 +If you want to install this extension for one of your PHP version, you can 
 +process ​as follows ​(example for the x86-64 ​architecture): 
 + 
 +### For a compiled PHP version
  
 +```shell
 +# cd /​usr/​local/​src
 +# wget http://​downloads3.ioncube.com/​loader_downloads/​ioncube_loaders_lin_x86-64.tar.gz
 +# tar -xzf ioncube_loaders_lin_x86-64.tar.gz
 +# cd ioncube
 +# PHP_EXT_DIR=$(/​opt/​phpswitcher/​%ymd%/​php%version%/​bin/​php-config --extension-dir)
 +# cp ioncube_loader_lin_%version%.so $PHP_EXT_DIR/​ioncube.so
 +# echo "​zend_extension = $PHP_EXT_DIR/​ioncube.so"​ > /​opt/​phpswitcher/​%ymd%/​php%version%/​etc/​php/​conf.d/​01_ioncube.ini
 ``` ```
-cd /​usr/​local/​src + 
-wget http://​downloads3.ioncube.com/​loader_downloads/​ioncube_loaders_lin_x86-64.tar.gz +Finally, you must restart the Web server or PHP-FPM instance, depending on the 
-tar -xzf ioncube_loaders_lin_x86-64.tar.gz +i-MSCP httpd server implementation in use. 
-cd ioncube + 
-PHP_EXT_DIR=$(/​opt/​phpswitcher/​%ymd%/​php%version%/​bin/​php-config ​--extension-dir) +### For a packaged PHP version 
-cp ioncube_loader_lin_%version%.so $PHP_EXT_DIR/​ioncube.so + 
-echo "zend_extension ​= $PHP_EXT_DIR/​ioncube.so"​ > /opt/phpswitcher/%ymd%/php%version%/etc/php/​conf.d/​01_ioncube.ini+```shell 
 +# apt-get update 
 +# apt-get install php%version%-dev 
 +cd /​usr/​local/​src 
 +wget http://​downloads3.ioncube.com/​loader_downloads/​ioncube_loaders_lin_x86-64.tar.gz 
 +tar -xzf ioncube_loaders_lin_x86-64.tar.gz 
 +cd ioncube 
 +PHP_EXT_DIR=$(php-config%version% --extension-dir) 
 +cp ioncube_loader_lin_%version%.so ​"$PHP_EXT_DIR"/​ioncube.so 
 +echo -e "; priority=01\nzend_extension ​= $PHP_EXT_DIR"/​ioncube.so" ​>> /etc/php/%version%/mods-available/ioncube.ini 
 +# phpenmod -v %version% ioncube
 ``` ```
  
-then, you must restart the Web server or PHP-FPM instance, depending on the+Finally, you must restart the Web server or PHP-FPM instance, depending on the
 i-MSCP httpd server implementation in use. i-MSCP httpd server implementation in use.
  
-##phpinfo ​files+## PHP configuration information (phpinfo)
  
-For each PHP version that is setup through ​the PhpSwitcher administration +This feature allows ​the customers to access the configuration information of 
-interface (see below), a static phpinfo file is generated, which allows your +various ​PHP versions through ​their own PhpSwitcher interface. This feature can 
-customers to get PHP information via their own PhpSwitcher interface. This +be disabled by editing the plugin configuration fileand by triggering a plugin 
-feature, if not desired, ​can be disabled by editing the plugin configuration +list update through the plugin management interface.
-file and by triggering a plugin list update through the plugin management +
-interface.+
  
-Be aware that because ​the phpinfo files are static, you must re-generate them +### With the i-MSCP ​FPM httpd server implementation
-each time you made a configuration change for a specific PHP version (e.g. when +
-you enable or disable a PHP/Pecl extension). This task can be done through the +
-PhpSwitcher administration interface. Be also aware that because those files +
-are static, some information such as memory could not matches with those that +
-you have set for your customers (e.g. using the PHP editor provided by i-MSCP).+
  
-## Setup of new PHP versions+The plugin make use of the default `www.conf` FPM pool of each PHP version to 
 +serve the PHP configuration information at runtime.
  
-Once you have installed new PHP versions, you need to setup them into the +### With the i-MSCP Fcgid httpd server implementation
-PhpSwitcher plugin to make them available for your customers.+
  
-### Automatic setup+The plugin generate a static PHP info file for each PHP version. Because the 
 +information are static, you must not forget to re-generate them each time you do 
 +a configuration change for a specific PHP version (e.g. when you enable or 
 +disable a PHP/PECL extension). This task can be done through the PhpSwitcher 
 +administration interface, for each PHP version.
  
-Simply execute the following command:+## Registration of new PHP versions
  
-``` +You can register new PHP version either using the `php_compiler.plscript 
-cd perl /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler +(recommended),​ or manually through the PhpSwitcher administration interface. 
-perl php_compiler.pl --auto-setup ​--install-dir %installdir%+ 
 +### Registration through the `php_compiler.plscript 
 + 
 +To register a PHP version, you need to execute the following command: 
 + 
 +```shell 
 +perl /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler/php_compiler.pl --register ​--install-dir %installdir%
 ``` ```
  
-Note that doing this is only required if you do not have used the +See the previous documentation sections for all possible options, notably those 
-`--auto-setup` command line option while compiling your PHP versions.+which apply to packaged ​PHP versions.
  
-### Manual setup+### Registration through the PhpSwitcher administration interface
  
 1. Login into the panel as administrator and go to the PhpSwitcher 1. Login into the panel as administrator and go to the PhpSwitcher
    ​administration interface (settings section)    ​administration interface (settings section)
-2. Setup your new PHP versions as follow:+2. Setup your new PHP versions as follows:
  
     #### Common settings (Required)     #### Common settings (Required)
Line 369: Line 475:
      - Path to binary: /​opt/​phpswitcher/​%ymd%/​php%version%/​bin/​php-cgi      - Path to binary: /​opt/​phpswitcher/​%ymd%/​php%version%/​bin/​php-cgi
  
-    #### PHP-FPM settings (Only required if you use the PHP-FPM httpd server implementation)+    #### PHP-FPM settings (Required)
      - Path to binary: /​opt/​phpswitcher/​%ymd%/​php%version%/​sbin/​psw%version%-fpm      - Path to binary: /​opt/​phpswitcher/​%ymd%/​php%version%/​sbin/​psw%version%-fpm
      - Path to configuration file: /​opt/​phpswitcher/​%ymd%/​php%version%/​etc/​php-fpm.conf      - Path to configuration file: /​opt/​phpswitcher/​%ymd%/​php%version%/​etc/​php-fpm.conf
Line 389: Line 495:
 ``` ```
 i-MSCP PhpSwitcher plugin i-MSCP PhpSwitcher plugin
-© 2014-2017 Laurent Declercq <​[email protected]>​+© 2014-2019 Laurent Declercq <​[email protected]>​
 i-MSCP License <​https://​www.i-mscp.net/​license-agreement.html>​ i-MSCP License <​https://​www.i-mscp.net/​license-agreement.html>​
 ``` ```
- 
-See the LICENSE file inside the archive for further details. 
 </​markdown>​ </​markdown>​
/var/www/virtual/i-mscp.net/wiki/htdocs/data/pages/plugins/phpswitcher.txt · Last modified: 2019/10/04 20:22 by nuxwin