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
plugins:phpswitcher [2017/04/01 05:59]
nuxwin
plugins:phpswitcher [2019/10/04 20:22] (current)
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.3
  
 Provides additional PHP versions for customers. Provides additional PHP versions for customers.
Line 12: Line 9:
 ## Requirements ## Requirements
  
-- i-MSCP Serie 1.3.x, 1.4.x +- One of the [supported distributions](#​supported_distributions) 
-Either the Fcgid or the PHP-FPM (recommended) 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 commands:+### Supported distributions
  
-``` +- 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 configuration level. This allow your customers to +Recommended use of this plugin ​is with the i-MSCP FPM httpd server in **UDS** 
-set different PHP versions for any of their domains (domain, subdomains...).+mode, and with the **per_site** PHP configuration level.
  
 ## 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 to know how)+4. Compile, install and/or register ​your PHP versions ​
  
 ## Glossary ## Glossary
Line 43: 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.45.5, 5.6, 7.0 or 7.1 +- %version% ​   : One of available PHP version such as 7.17.2, 7.37.... 
-- %ymd%*       : The date of the day such as 20170306 +- %ymd%        : The date of the day such as 20190831 
-- %installdir% : Installation directory ​for PHP versions ​such as /​opt/​phpswitcher/​20170306+- %installdir% : Installation directory such as /​opt/​phpswitcher/​20170306
  
-## Setup new PHP versions+## Compiled ​PHP versions
  
-At first, you must download, configure, compile and install ​the PHP versions ​that you want make available for your +This plugin provides the `php_compiler.pl` script that can, compile and install 
-customersFor this, you must use the PHP compiler that is shipped with this plugin.+additional ​PHP versions ​in one stepIt can also register them in the 
 +Phpswitcher ​plugin.
  
-### PHP compiler +For example, if you want to compile and install all additional ​PHP versions, you 
- +can execute the following command:
-The PHP compiler is a Perl script that downloads, configures, compiles and installs additional PHP versions in one step, +
-without any human interaction. It can also automatically setup PHP versions (make the PhpSwitcher plugin aware of them). +
- +
-For instance, if you want to install all available ​PHP versions, you 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 the following command:+or if you want to install specific PHP versions:
  
-``` +```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 ​the `--auto-setupcommand line option. +You can also automatically ​register ​the PHP versions ​in the PhpSwitcher plugin 
-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 versions. ​Doing this avoid the need to +Doing this avoid the need to register them manually through the PhpSwitcher 
-setup all PHP versions ​manually through the PhpSwitcher administration interface.+plugin ​administration interface.
  
-#### Supported PHP versions+### Supported PHP versions
  
-PHP versions ​that are provided by the PHP compiler depend on the i-MSCP httpd server implementation in use. Older PHP +The supported ​PHP versions are the last that were available when this plugin 
-versions such as PHP 4.4 and PHP 5.2 don't provide ​the `fpmSAPI. Thus, the PHP compiler doesn'​t provides these +version has been releasedThis means that by default, the versions provided by 
-versions when it detects that you use the PHP-FPM Apache2 i-MSCP httpd server implementation.+the `php_compiler.plscript 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 ​PHP versions are supported`4.4`, `5.2`, +Supported ​PHP versions are: `5.3` up-to `7.4`
-`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 following PHP versions are supported: ​`5.3`+#### Forcing ​the `php_compiler.plscript to download latest PHP sources
-`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 plugin version has been released. This +You can ask the `php_compiler.pl` script ​to download ​latest ​PHP sources ​by 
-means that by default, the versions provided by the PHP compiler ​can be lower than the last that were released on the +passing ​the `--force-last` option. However, you must bear in mind that some 
-PHP siteIn such case, you can ask the PHP compiler ​to download ​the last available ​PHP version ​by adding ​the +patches ​might not longer apply, ​in which case you should report us the failure 
-`--force-last` ​command line option. However, you must be aware that some patches ​could not longer apply on these +message by creating a new issue on our bug tracker.
-versions. If so, you should report us the failure message by creating a new issue on our bug tracker.+
  
-#### Build and installation directories+### Download directory
  
-By default, the PHP compiler will build the new PHP versions into the `/​usr/​local/​src/​phpswitcher/​php%version%+By default, the PHP sources are downloaded in the `/​usr/​local/​src/​phpswitcher` 
-directory, and install them in the `/​opt/​phpswitcher/​%ymd%/​php%version%` ​directory ​but you can change this behavior +directory. You can override ​the default download ​directory ​by passing the 
-with the `--install-dir` command line option.+`--download-dir` option ​to the `php_compiler.pl` script.
  
-To get list of all available command line options, you can execute the following command:+### Build directory
  
-``` +By default, the compiled PHP versions are build in the 
-# cd /var/www/imscp/gui/plugins/​PhpSwitcher/​PhpCompiler +`/usr/local/src/phpswitcher/php%version%` directory. You can override the 
-# perl php_compiler.pl ​--help +default build directory by passing the  `--build-dir` option to the 
-``+`php_compiler.plscript.
- +
-#### SSL support for PHP 4.4 +
- +
-PHP 4.4 is built against a self-compiled OpenSSL library (openssl-0.9.8).+
  
-#### SSL support for PHP >= 4.4 but < 5.6+### Installation directory
  
-For systems on which OpenSSL library is greater or equal to 1.1.0, PHP versions ​greater than 4.4 but older than 5.6 are +By defaultthe compiled ​PHP versions are installed in the 
-built against a self-compiled OpenSSL library (1.0.2k).+`/​opt/​phpswitcher/​%ymd%/​php%version%` directoryYou can override the 
 +default installation directory by passing the  `--install-dir` option to the 
 +`php_compiler.pl` script.
  
-#### Changes made on PHP versions+### Changes made on PHP sources
  
-PHP versions provided by the PHP compiler are almost identical to those that are provided by the Debian team. For each +set of patches is applied on PHP sources ​before ​configuring ​them. The patches 
-PHP version, a set of patches is applied on PHP upstream source ​before ​compiling ​them. The patches include the following +include the following changes:
-changes:+
  
 - Multiarch support - Multiarch support
-Usage of libtool as provided by Debian/​Ubuntu team 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 adjusted ​when needed, while some other were +Most of the patches were pulled from the Debian PHP team git repository ​and 
-created to resolve FTBFS issues ​or adjust configuration. Patches which were not pulled from Debian PHP source packages +modified ​when needed, while some other were created to resolve FTBFS issues. 
-have the `nxw_` prefix in their names.+Patches which were not pulled from Debian PHP team git repository ​have the 
 +`nxw-` prefix in their names.
  
-#### Available ​PHP extensions+### PHP extensions
  
-Available ​PHP extensions are the same that are enabled in PHP versions ​provided by Debian/​Ubuntu ​team. However, it must +PHP extensions are the same that are provided by PHP versions ​from the Debian 
-be noted that some of them can have been disabled for some PHP versions due to incompatibilities with system libraries +PHP team. Most are compiled as shared module.
-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 isn't available, it will go ahead and +### PHP runtime ​dependencies ​(since version 5.0.0)
-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 enabled whenever possibleThis feature +### Build environment (since version 5.0.0)
-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. 
-```+ 
 +You can switch back to the historical behavior by passing the `--no-chroot` 
 +option to the `php_compiler.plscript.
  
-Here, only one recipe will be run at time.+### Parallel Execution (GNU make)
  
-See https://​www.gnu.org/​software/​make/​manual/​html_node/​Parallel.html for further details about this feature.+For faster compilation,​ the parallel execution feature provided by GNU make is 
 +enabledThis 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.
  
-#### Installation layout+See [Parallel Execution](https://​www.gnu.org/​software/​make/​manual/​html_node/​Parallel.html) 
 +for further details about this feature.
  
-First of all, you must note that in all cases, we build the following PHP SAPIs: `cli`, `cgi` and `fpm`. This allows +### Installation layout
-switching on other i-MSCP httpd server implementation without having to rebuild all PHP versions. This is also needed +
-to build static phpinfo files. Indeed, we always use the PHP FastCGI binary to build them.+
  
-For all PHP versions provided by the PHP compiler, the following installation layout applies:+For all PHP versions provided by the PHP compiler, the following installation 
 +layout applies:
  
 #### Common to all PHP SAPIs #### Common to all PHP SAPIs
Line 187: 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 199: 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 to avoid conflict with PHP versions ​ +As you can see, there is a specific naming convention for PHP-FPM. This is needed 
-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`.
  
-## Configuration+#### Static paths (since version 5.0.0)
  
-### PHP configuration+For convenience,​ the `php_compiler.pl` script also creates symlinks to the 
 +installation directories of various ​PHP versions, which allows the sysadmin 
 +to access the PHP binaries always by the same paths (e.g. in CRONTAB(5) files).
  
-First of all, it is important to note that it is useless to edit any PHP configuration file located under the +These symlinks are created in the `/opt/phpswitcher/staticdirectoryeither at 
-`/etc/php%version%` or `/etc/​php/​%version%directories. Indeed, the files located under these directories are only +the installation stage, or at the registration stage. If you do not want these 
-relevant for the PHP versions provided by your distribution.+symlinks, you can pass the `--no-static-paths` option to the `php_compiler.pl` 
 +script.
  
-For the same reasonsit is useless to try to enable/​disable a PHP module using the command line tools +Note that when the symlinks are availablethey will be used for registration 
-php5enmod/​php5dismod or phpenmod/​phpdismod that are provided by your distribution. Those tools only operate on the INI +process in place of the default paths.
-files that are provided by your distribution.+
  
-#### PEAR packages+## Packaged PHP versions (since version 5.0.0)
  
-Each PHP version comes with its own PEAR distribution that is installed under the +The `php_compiler.plscript also make possible ​to register packaged PHP 
-`/​opt/​phpswitcher/​%ymd%/​php%version%/​share/​peardirectory. Please don't try to include PEAR library from another +versions in the PhpSwitcher plugin. Packaged PHP versions ​are either those 
-location without knowning what you are doing. Doing this could lead to serious problems. +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:
-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 instance:+
  
 +```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 a 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
 +the `pear` command provided by the compiled PHP version for which you want act.
 +For instance:
 +
 +```shell
 # cd /​opt/​phpswitcher/​%ymd%/​php%Version%/​bin # cd /​opt/​phpswitcher/​%ymd%/​php%Version%/​bin
 # ./pear install Net_SMTP # ./pear install Net_SMTP
 ``` ```
  
-###PHP extensions+### For a packaged ​PHP version
  
-For convenience,​ most of PHP extensions are compiled as shared modules. When installing ​new PHP version, ​the PHP +For a packaged PHP version, you just need to install the distribution package: 
-compiler create ​a specific INI file that enable most of available PHP extensions. By default, this file is located at+ 
 +```shell 
 +# apt-get update 
 +# apt-get install php-net-smtp 
 +``` 
 + 
 +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 a 
 +compiled ​PHP version ​is being installed, a specific INI file that enable most of 
 +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 distribution ​PHP packages ​where an INI file is +Here, a single INI file is involved. This is not like with a packaged ​PHP 
-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 then, restart the Web server or PHP-FPM +To enable/​disable a specific PHP extension, you must just edit the modules.ini 
-instance, depending on the i-MSCP httpd server implementation in use.+INI file and once done, restart the Web server or PHP-FPM instance, depending on 
 +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` commands that are shipped with your +For packaged PHP version, you can enable/​disable ​the PHP extensions using the 
-distribution. Instead, you must use the commands that are provided in the directory of the PHP version for which you +phpenmod/​phpdismod command provided by your distribution.
-want act.+
  
-For instance, if you want install the `ImageMagick` Pecl extension you must do as follow:+## PECL extensions
  
-``` +### For a compiled PHP version 
-# apt-get update ​&& ​apt-get 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 i-MSCP httpd server implementation in use.+Finally, you must restart the Web server or PHP-FPM instance, depending on the 
 +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 of the APC extension. It is a good +For packaged ​PHP version, you just need to install ​the distribution package:
-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 as follow+```shell 
 +# apt-get update 
 +# apt-get ​install ​php%version%-imagick 
 +``` 
  
 +or if there is none, you can process as follows:
 +
 +```shell
 +# apt-get update
 +# 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
 ``` ```
-# cd /​opt/​phpswitcher/​%ymd%/​php%version%/​bin + 
-./pecl install ​channel://pecl.php.net/​apcu-%apcu_version% +Finally, you must restart the Web server, or PHP-FPM instance, depending on the 
-PHP_EXT_DIR=$(/opt/phpswitcher/​%ymd%/​php%version%/​bin/​php-config ​--extension-dir) +i-MSCP httpd server implementation in use. 
-# echo "​extension = $PHP_EXT_DIR/apcu.so"​ > /opt/​phpswitcher/%ymd%/php%version%/​etc/​php/​conf.d/02_apcu.ini+ 
 +You can uninstall the PECL extension by following the same procedure, replacing 
 +the pecl `install` command by the pecl `uninstall` commandHowever, you'll have 
 +to disable the module firstFor instance: 
 + 
 +```shell 
 +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
 ``` ```
  
-then, you must restart ​the Web server or PHP-FPM instancedepending on the i-MSCP ​httpd server implementation in use.+**WARNING:​** In both cases, you must not forget to reset the various 
 +alternatives to their previous valuesas required by i-MSCP ​core:
  
-Note that the APcu version to install depends on your PHP version+```shell 
 +# 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"​ 
 +```
  
-- 4.0.x for PHP 5.5.x and 5.6.x +## IonCube loader
-- 5.1.x for PHP 7.0.x and PHP 7.1.x+
  
-#### 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):​
  
-If you want to install this extension for one of your PHP version, you can do as follow (example for an x86-64 arch):+### For a compiled ​PHP version
  
-```+```shell
 # cd /​usr/​local/​src # cd /​usr/​local/​src
 # wget http://​downloads3.ioncube.com/​loader_downloads/​ioncube_loaders_lin_x86-64.tar.gz # wget http://​downloads3.ioncube.com/​loader_downloads/​ioncube_loaders_lin_x86-64.tar.gz
Line 294: Line 406:
 ``` ```
  
-then, you must restart the Web server or PHP-FPM instance, depending on the i-MSCP httpd server implementation in use.+Finally, you must restart the Web server or PHP-FPM instance, depending on the 
 +i-MSCP httpd server implementation in use.
  
-### phpinfo files+### For a packaged PHP version
  
-For each PHP version ​that is setup through the PhpSwitcher administration interface ​(see below), a static phpinfo file +```shell 
-is generated, which allows your customers to get PHP information via their own PhpSwitcher interfaceThis feature, if +# apt-get update 
-not desired, can be disabled by editing the plugin configuration file and by triggering a plugin list update through the +# apt-get install php%version%-dev 
-plugin management interface.+# 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 
 +```
  
-Be aware that because the phpinfo files are static, you must re-generate them each time you made a configuration change +Finally, you must restart the Web server ​or PHP-FPM instance, depending on the 
-for a specific PHP version (e.g. when you enable ​or disable a PHP/Pecl extension). This task can be done through ​the +i-MSCP ​httpd server implementation in use.
-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+## PHP configuration information (phpinfo)
  
-Once you have installed new PHP versions, you need to setup them into the PhpSwitcher plugin ​to make them available for +This feature allows the customers ​to access ​the configuration information of 
-your customers.+various PHP versions through their own PhpSwitcher ​interface. This feature can 
 +be disabled by editing the plugin configuration file, and by triggering a plugin 
 +list update through the plugin management interface.
  
-#### Automatic setup+### With the i-MSCP FPM httpd server implementation
  
-Simply execute ​the following command:+The plugin make use of the default `www.conf` FPM pool of each PHP version to 
 +serve the PHP configuration information at runtime.
  
-``` +### With the i-MSCP Fcgid httpd server implementation 
-cd perl /​var/​www/​imscp/​gui/​plugins/​PhpSwitcher/​PhpCompiler + 
-# perl php_compiler.pl --auto-setup ​--install-dir %installdir%+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. 
 + 
 +## Registration of new PHP versions 
 + 
 +You can register new PHP version either using the `php_compiler.plscript 
 +(recommended),​ or manually through the PhpSwitcher administration interface. 
 + 
 +### 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 `--auto-setup` command line option while compiling +See the previous documentation sections for all possible options, notably those 
-your PHP versions.+which apply to packaged ​PHP versions.
  
-#### Manual seteup+### Registration through the PhpSwitcher administration interface
  
-1. Login into the panel as administrator and go to the PhpSwitcher administration interface (settings section) +1. Login into the panel as administrator and go to the PhpSwitcher 
-2. Setup your new PHP versions as follow:+   administration interface (settings section) 
 +2. Setup your new PHP versions as follows:
  
-    ​##### Common settings (Required)+    #### Common settings (Required)
      - Path to PEAR directory: /​opt/​phpswitcher/​%ymd%/​php%version%/​share/​pear      - Path to PEAR directory: /​opt/​phpswitcher/​%ymd%/​php%version%/​share/​pear
  
-    ​##### PHP FastCGI settings (Required)+    #### PHP FastCGI settings (Required)
      - 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 343: Line 482:
 ## Plugin translation ## Plugin translation
  
-You can translate this plugin using a gettext translation editor such as `poedit`. Translation files are located under +You can translate this plugin using a gettext translation editor such as 
-the `./l10n` directory inside of this plugin archive. Once translated you can send us your translation file (po file) +`poedit`. Translation files are located under the `./l10n` directory inside of 
-for integration in future release.+this plugin archive. Once translated you can send us your translation file 
 +(po file) for integration in future release.
  
-Note that if no translation file exists for your localization in the `./l10n/po` directory, you must create it first +Note that if no translation file exists for your localization in the 
-from the l10n/​PhpSwitcher.pot file. Be aware that your file must be UTF-8, else, it won't be accepted.+`./l10n/po` directory, you must create it first from the l10n/​PhpSwitcher.pot 
 +file. Be aware that your file must be UTF-8, else, it won't be accepted.
  
 ## License ## License
Line 354: 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/attic/plugins/phpswitcher.1491026378.txt.gz · Last modified: 2017/04/01 05:59 by nuxwin