Thứ Hai, 26 tháng 8, 2024

How to add a custom PHP version in Plesk for Linux?

 

Question

How to add a custom PHP version in Plesk for Linux?

Answer

Warning: All the instructions below are to be performed at own will and risk. These steps are provided for demonstration purposes only and not supported by Plesk. Depending on the operating system and the desired configuration, installation steps might differ significantly. When installing an additional PHP version on the server, read the official PHP documentation on installation. It's recommended to perform the installation on a test environment before modifying the production environment.

On Linux systems, you can install any PHP version you need and then make it available in Plesk by registering it with the plesk bin php_handler command-line utility.


1- Install the custom PHP version

Install the desired PHP version on the server. For installation guidelines, refer to the official PHP documentation available at http://php.net/manual/en/install.php. In brief, the installation includes the following main steps.

  1. Connect to the server via SSH

  2. Install C compiler and XML library with the following commands:

    • RHEL based OSes:

      yum install gcc -y && yum install libxml2-devel -y

    • Debian based OSes:

      apt-get install build-essential && apt-get install libxml2-dev

  3. Download the PHP source you need from the official website (http://php.net/downloads.php or http://php.net/releases/) to the server and unpack it:

    gunzip php-NN.tar.gz

    tar -xf php-NN.tar

  4. Configure and build PHP:

    Note: In this step, it's possible to customize PHP with various options, such as specifying which extensions will be enabled in the compiled PHP version. Run ./configure --help to see a list of the available options.

    cd ../php-NN

    ./configure --prefix=/usr/local/phpNN --enable-fpm --with-fpm-group=www-data

    make

    make install

  5. Set up the php.ini:

    Note: Edit the .ini file to set the desired PHP options. If it's required to configure the  php.ini file in another location, run the configure utility with the option --with-config-file-path=/some/path in the previous step.

    cp php.ini-development /usr/local/lib/php.ini

    2- Register the custom PHP version in Plesk
    1. Connect to the server via SSH

    2. Register the new PHP version in Plesk:

      Note: More information can be found with the following command: plesk bin php_handler --help

      2.1- CGI/FastCGI example:

      plesk bin php_handler --add -displayname <NN> -path <path to php-cgi binary> -phpini <path to php.ini> -type <php handler> -id <NN-custom> -clipath <path to php cli>

      Where:

        • -displayname <NN>: It's the PHP version name that will be shown in the Plesk UI. It's recommended to include the version number in the displayname, for example: 7.4.5-custom
        • -path <path to php-cgi binary>: It's the location of the PHP CGI binary file. The location is shown in the output shown by the command make install in the line Installing PHP CGI binary. For example, if the output contains the line Installing PHP CGI binary: /usr/local/bin/, the location to specify is /usr/local/bin/php-cgi. Learn more at: http://php.net/manual/en/install.unix.commandline.php
        • -clipath <path to php cli>: It's the location of the PHP CLI binary file. The location is shown in the output of the command make install in the line Installing PHP CLI binary. For example, if the output contains the line Installing PHP CLI binary: /usr/local/bin/, the location to specify is /usr/local/bin/php. Learn more at: http://php.net/manual/en/install.unix.commandline.php
        • -phpini <path to php.ini>: It's the location of the php.ini file, for example: /usr/local/lib/php.ini 
        • -type <php handler>: It's the type of the PHP handler associated with the installed PHP version. This example is for cgi , fpm or fastcgi PHP handlers and the mod_php is not supported
        • (Optional) -id <NN-custom>: It's the identifier that will be used for referring to this PHP version when adjusting or removing it via plesk bin php_handlers utility

      2.2- FPM example (Notes: systemctl unit should also be created manually, if it specific for OS distribution; To add the PHP handler as a dedicated application, append '-fpm-dedicated' to the hander ID when registering; To add PHP as a 'usual' FPM application, add the handler second time, without the '-fpm-dedicated' ):

      plesk bin php_handler --add -displayname <NN> -path <path to php-fpm binary> -phpini <path to php.ini> -type fpm -id <NN-custom> -clipath <path to php cli> -service <PHP_FPM_service_name> -poold <path to php-fpm.d pool folder>

      Where:

        • -path <path to php-fpm binary>: It's the location of the PHP FPM binary file. The location is shown in the output shown by the command make install in the line Installing PHP-FPM binary
        • -service <PHP FPM service name>: It's the PHP FPM service name
        • -poold <path to php-fpm.d pool folder>: It's the location containing the pool configuration files
        • 3- Assign the custom PHP version (Plesk GUI)

          Once the custom PHP versions are registered after applying the steps above, the custom PHP versions will be available:

          1. Log in to Plesk GUI

          2. Assign the custom PHP version:

            • Service Plan level: Go to Service Plans > Service Plan Name > PHP Settings

            • Domain level: Go to Domains > example.com > PHP Settings

Read More

Thứ Tư, 14 tháng 8, 2024

Cwrsync Invalid UID Nobody solution

 The following error occurred while using the Rsync/cwrsync tool for file synchronization:

C:Program Filescwrsyncbin>rsync.exe-av Rsync://192.168.0.211:52326/test/cygdrive/e/www.01314.cn/rsync  
@ Error:invalid UID Nobody  

Workaround: Add the following two lines to the rsyncd.conf file to resolve the problem
UID = 0
GID = 0
Full rsyncd.conf file

UID = 0 
gid = 0 Use 
chroot = False 
Strict modes = False 
hosts allow = *  
log file = Rsyncd.log  
pid FILE = rsyncd.pid  
port = 52326  
Max connections = 4 
 
# Module Definitions  
# Remember Cygwin naming Conve Ntions:c:work becomes/cygwin/c/work  
#  
[Test]  
path =/cygdrive/e/rsync/res  
Read Only = yes 
Transfer logging = yes 
lock file = Rsyncd.lock  

Cwrsync the permissions configuration and invalid UID Nobody of client password files

Cwrsync the client password file's permissions configuration disposition method.

Windows uses chmod under Cygwin
After creating the document, change the authority to 600.
chmod 600/rsyncd.passwd
Invalid UID Nobody disposal method.
Fix config file: rsyncd.conf
Add at the beginning of the file
UID = 0
GID = 0

Read More

Technical Note: Policy IDs column in FortiMail History Log

 Description

 

This article describes that an additional column called 'Policy IDs' was added to the History Log in FortiMail firmware v5.0. This is very useful in troubleshooting which policies or access controls are generating the log entries.


Scope

 
FortiMail v5.0 onwards.


Solution

 

The Policy ID value is separated into 3 different columns:

<Access Control> : <IP Policies> : <Recipient Policies>

For example: Policy IDs 9:1:3

This means it is hitting Access Control ID 9, IP Policy 1 and Recipient Policy 3. 
If no access control policies were created, Fortimail will use the default access control policy which has the number '0' to relay inbound emails.
Read More