ISPConfig 3 PHP олон хувилбар суулгах

Дусал нэвтэрхий толь-с

https://www.howtoforge.com/tutorial/how-to-install-php-7-for-ispconfig-3-from-debian-packages-on-debian-8-and-9/

2 Enable PHP versions in ISPConfig

In ISPConfig 3, you can configure the new PHP versions under System > Additional PHP Versions. Add Debian's PHP version

You can skip this step if you do not have a Debian version of PHP installed.

First of all you have to add a new version for the already installed PHP version. On the Name tab, you just fill in a name for the PHP version (e.g. Debian 5.6) - this PHP version will be listed under this name in the website settings in ISPConfig:

Enter the name of the custom PHP version

Go to the FastCGI Settings tab and fill out the fields as follows:

Path to the PHP FastCGI binary: php5-cgi Path to the php.ini directory: /etc/php5/cgi/php.ini

PHP 7.1 FastCGI

Then go to the PHP-FPM Settings tab and fill out the fields as follows:

Path to the PHP-FPM init script: php5-fpm Path to the php.ini directory: /etc/php5/fpm/php.ini Path to the PHP-FPM pool directory: /etc/php5/fpm/pool.d

PHP 7.1 FPM settings Important step for cron jobs

If you use cron jobs calling PHP scripts you also have to tell cron which version to use. Add php5 in the beginning of the command to use the Debian's version. If you are not sure what you exactly are using follow the symlink /usr/bin/php and use its final destination as prefix. Add other PHP versions

Currently there are 3 versions available at https://packages.sury.org/php/ and you have to repeat the last step now for every version you will install. But use the following settings instead: PHP 5.6

Path to the PHP FastCGI binary: php-cgi5.6 Path to the php.ini directory: /etc/php/5.6/cgi/php.ini

Path to the PHP-FPM init script: php5.6-fpm Path to the php.ini directory: /etc/php/5.6/fpm/php.ini Path to the PHP-FPM pool directory: /etc/php/5.6/fpm/pool.d

The cli version for e.g. cron jobs has the name php5.6. PHP 7.0

Path to the PHP FastCGI binary: php-cgi7.0 Path to the php.ini directory: /etc/php/7.0/cgi/php.ini

Path to the PHP-FPM init script: php7.0-fpm Path to the php.ini directory: /etc/php/7.0/fpm/php.ini Path to the PHP-FPM pool directory: /etc/php/7.0/fpm/pool.d

The cli version for e.g. cron jobs has the name php7.0. PHP 7.1

Path to the PHP FastCGI binary: php-cgi7.1 Path to the php.ini directory: /etc/php/7.1/cgi/php.ini

Path to the PHP-FPM init script: php7.1-fpm Path to the php.ini directory: /etc/php/7.1/fpm/php.ini Path to the PHP-FPM pool directory: /etc/php/7.1/fpm/pool.d

The cli version for e.g. cron jobs has the name php7.1. PHP 7.2

Path to the PHP FastCGI binary: php-cgi7.2 Path to the php.ini directory: /etc/php/7.2/cgi/php.ini

Path to the PHP-FPM init script: php7.2-fpm Path to the php.ini directory: /etc/php/7.2/fpm/php.ini Path to the PHP-FPM pool directory: /etc/php/7.2/fpm/pool.d

The cli version for e.g. cron jobs has the name php7.2. PHP 7.3

Path to the PHP FastCGI binary: php-cgi7.3 Path to the php.ini directory: /etc/php/7.3/cgi/php.ini

Path to the PHP-FPM init script: php7.3-fpm Path to the php.ini directory: /etc/php/7.3/fpm/php.ini Path to the PHP-FPM pool directory: /etc/php/7.3/fpm/pool.d

The cli version for e.g. cron jobs has the name php7.3. 3 Change PHP version of websites

You can skip this step if you do not have a Debian version of PHP installed.

Now change the PHP version of all websites to the newly created version (e.g. Debian 5.6).

And do not forget to change the cron jobs as mentioned above. 4 Add the repository at packages.sury.org

To add the repository at packages.sury.org and its BGP keys to apt use these commands:

apt-get install -y apt-transport-https lsb-release ca-certificates

wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

The next command is just one line, don't add any line breaks:

echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list

apt-get update

To upgrade already installed packages from the new repository use this command:

apt-get upgrade

5 Install PHP from packages.sury.org

I am offering here multiple options to install, please pick the desired versions and simply skip the rest! 5.1 Install PHP 5.6

To install PHP use this command:

apt-get install php5.6 php5.6-cli php5.6-cgi php5.6-fpm

5.2 Install PHP 7.0

To install PHP use this command:

apt-get install php7.0 php7.0-cli php7.0-cgi php7.0-fpm

5.3 Install PHP 7.1

To install PHP use this command:

apt-get install php7.1 php7.1-cli php7.1-cgi php7.1-fpm

5.4 Install PHP 7.2

To install PHP use this command:

apt-get install php7.2 php7.2-cli php7.2-cgi php7.2-fpm

5.5 Install PHP 7.3

To install PHP use this command:

apt-get install php7.3 php7.3-cli php7.3-cgi php7.3-fpm

5.6 Install the lastest PHP version

To install the lastest PHP version use this command:

apt-get install php php-cli php-cgi php-fpm

6 Install Memcache extension (optional)

To install Memcache use this command:

apt-get install php-memcache php-memcached

7 Install APCu extension (optional)

To install APC user cache use this command:

apt-get install php-apcu php-apcu-bc

8 Install xDebug extension (optional)

The xDebug module is a debugging extension for PHP. The installation is optional.

To install xDebug use this command:

apt-get install php-xdebug

This package seems to have other default settings than the Debian package php5-xdebug. Depending on your software you have to change settings like xdebug.max_nesting_level to get it running! 9 Install other extensions (optional)

There are a lot of additional extensions you can install for PHP. Here is a list of available packages, some of them you have to install for each version separately. Simply delete packages you are not going to use from the following commands: 9.1 Version independent packages

apt-get install

9.2 Version dependent packages

apt-get install

10 Set Debian default PHP back to the original version

The default PHP of the operating system has to remain at the original version. To fix that, run these commands:

update-alternatives --config php update-alternatives --config php-cgi

On Debian 9: Choose PHP 7.0, on Debian 8, choose PHP 5.6 in the dialog that appears. 11 Restart FPM daemon

Finally, restart the php-fpm daemons. Run the commands for the previously installed ones:

service php5.6-fpm restart

service php7.0-fpm restart

service php7.1-fpm restart

service php7.2-fpm restart

service php7.3-fpm restart