المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : كلاود لينكس Cloud Linux جعل اصدار alt-php 7.4 الافتراضى لجميع العملاء



Rise Company
22-07-2022, 00:45
كلاود لينكس Cloud Linux جعل اصدار alt-php 7.4 الافتراضى لجميع العملاء
Cpanel CloudLinux set all users to use alt-php

https://www.rise.company/upload/uploads/165844662129281.png

if your cpanel server have cloudlinux + PHP Selector installed
you need to set all site to use inherit PHP before you can use PHP Selector.

فى الكلاود لينكس هتجد دائما لديك نوعين من php ويجب ان يكون كلاهما موجود
ea-php
alt-php
من داخل Multiphp يجب ان تختار الافتراضى للسيرفر و العملاء ea-php 7.4
او اجعل العملاء inherit للاصدار الاساسى للسيرفر ea-php 7.4

اذا اخترت alt هذا خطا ! يلغى php selector
لذلك اعتبر ea-php هو الاب اما alt-php هو الابن selector الى بيورث من الاب القدر المطلوب

من داخل php selector اذا اخترت الافتراضى هيفعل على الجديد اما القديم لا

https://www.rise.company/forum/images/imported/2022/07/4.png

ولجعل جميع المواقع تعمل على selector على اصدار alt-php7.4
لجميع العملاء ادخل هذا الامر

فقط ادخل هذا الامر


cd /var/cpanel/users
ls -1 | awk '{ print "selectorctl --set-user-current=7.4 --user="$1 }' | sh

----------------------------

وحتى لا يحدث ارتباك للعميل لوجود كلا ea-php و alt-php
قم باخفاء ea-php

Home » Packages » Feature Manager » Feature Lists » Manage feature list » select Default and uncheck the box for MultiPHP INI Editor and MultiPHP Manager. This will stop your customers from seeing MultiPHP Manager/Editor which can be very confusing.

شاهد ايضا
كلاود لينكس CLOUD LINUX حل مشكلة CANNOT MANAGE PHP VERSIONS WHEN CAGEFS IS DISABLED (https://www.rise.company/forum/showthread.php/97512-%D9%83%D9%84%D8%A7%D9%88%D8%AF-%D9%84%D9%8A%D9%86%D9%83%D8%B3-Cloud-Linux-%D8%AD%D9%84-%D9%85%D8%B4%D9%83%D9%84%D8%A9-Cannot-manage-PHP-versions-when-CageFS-is-disabled)
المرجع:
https://serverok.in/cpanel-cloudlinux-set-all-users-to-use-alt-php
https://cloudlinux.zendesk.com/hc/en-us/articles/360014084800-PHP-Selector-Integration-with-cPanel

Rise Company
22-07-2022, 01:29
Earlier, when EasyApache 3 was in trend, CloudLinux with PHP Selector would work seamlessly; you would set up the EasyApache profile which is compatible with PHP Selector, and you are ready to go. However, with EasyApache 4 cPanel introduced the built-in MultiPHP Manager (https://documentation.cpanel.net/display/68Docs/MultiPHP+Manager+for+cPanel) which changed everything.
https://www.rise.company/forum/images/imported/2022/07/2.jpg
The main advantage of the MultiPHP Manager is allowing users to select different PHP versions for each domain.
With CloudLinux, you can also make use of a similar feature: PHP Selector. PHP Selector has an important advantage over MultiPHP Manager: it allows a single cPanel user to manage PHP extensions without the need to contact his/her hoster. The user can enable/disable PHP extensions as he pleases. PHP Selector also leaves the choice of PHP version to the end-user, but the switch is made for the whole user, not for a separate website (as with MultiPHP Manager).
The main question a hoster should answer is which of the above features he will provide for his clients: MultiPHP Manager or PHP Selector. Using both can be confusing for the end-users. You can manage which features to show to your cPanel end-users in WHM Home » Packages » Feature Manager » Feature Lists.
If you'd like to use PHP Selector on a cPanel server, continue reading this document to understand how to integrate MultiPHP Manager and PHP Selector.
PrerequisitesBefore integrating PHP Selector with cPanel, make sure that you have the following components installed:


LVE Manager (https://docs.cloudlinux.com/lve_manager/#lve-manager)
CageFS (https://docs.cloudlinux.com/cloudlinux_os_components/#cagefs)
Our alt-php (https://docs.cloudlinux.com/cloudlinux_os_components/#php-selector)

ConfigurationOnce you’re done with PHP Selector’s installation (https://docs.cloudlinux.com/cloudlinux_os_components/#php-selector), there are a few things that you need to check on cPanel servers. You need to make sure that MultiPHP Manager settings are correct and that CageFS is enabled for the users. Let us cover the steps in detail.
Go to WHM -> MultiPHP Manager -> PHP Versions tab.
https://www.rise.company/forum/images/imported/2022/07/3.jpg


Make sure that the System PHP Version is set to one of the ea-phpXX ones.
Attention: Selecting the alt-phpXX (as a “System PHP Version”) will break the PHP Selector.

Switch the PHP-FPM to Off; the PHP Selector is not compatible with it.
Note: If you have PHP-FPM enabled for existing websites, you need to disable it for them.
Last but not least, make sure that the domains/accounts (where you'd like to use the PHP Selector) use the Inherited version. You need to do that because MultiPHP Manager has a higher priority than PHP Selector. So, if any other PHP version is set in this menu, it will overwrite the PHP version selected in PHP Selector for that domain.

That’s it! You are all set. The only thing that’s left is to make sure that you use the “Enable for all users (https://docs.cloudlinux.com/cloudlinux_os_components/#cagefs)” mode for CageFS if you’d like to keep PHP Selector for all users. You can enable it via:
# /usr/sbin/cagefsctl --enable-all
Frequently Asked Questions (FAQ)Q. How could I set the Inherited option for all new accounts/websites by default?A. You won’t have to; cPanel already sets the Inherited by default for all newly created accounts. You can find more information about the way PHP Inheritance works on this page (https://documentation.cpanel.net/display/EA4/PHP+Inheritance#PHPInheritance-Howinheritanceworks).
Q. How could I set the Inherited option for all new accounts/websites when I transfer them from one server to another?A. If after transferring users, they do not have Inherited version set in MultiPHP Manager, you can run this script to switch ALL domains on the server to Inherited version:
# for i in $(cut -d: -f1 /etc/userdatadomains );do whmapi1 php_set_vhost_versions version=inherit vhost-0=$i;done Attention! Be very careful with that script because it will change PHP versions for ALL domains on your server to inherited. If you are not sure that you want exactly this, use the WHM interface and manually select the domains you wish to switch PHP version for.
Q. What setup do you recommend for CL PHP Selector?A. The recommended setup is the one described in the "Configuration" part of this guide. Additionally, if you are using the Apache web server, we recommend using mod_lsapi as PHP Handler. Install it using this (https://docs.cloudlinux.com/cloudlinux_os_components/#apache-mod-lsapi-pro) guide. Enable it in WHM » MultiPHP Manager » Handlers.
Also, if you configured PHP Selector, we recommend disabling MultiPHP Manager for users. You can do that in Home » Packages » Feature Manager » Feature Lists » Manage feature list » select Default and uncheck the box for MultiPHP INI Editor and MultiPHP Manager. This will stop your customers from seeing MultiPHP Manager/Editor which can be very confusing.
Q. Can I disable alt-phpXX versions from MultiPHP Manager’s dropdown list?A. You can do so by editing the /opt/alt/alt-php-config/alt-php.cfg file. Once you edit it, run the following script:
/opt/alt/alt-php-config/multiphp_reconfigure.pyIt manages SCL prefixes for the Alt-PHP in /etc/scl/prefixes.
In this example, we keep the alt-php72 visible in the list only:
[MultiPHP Manager]
alt-php44 = no
alt-php51 = no
alt-php52 = no
alt-php53 = no
alt-php54 = no
alt-php55 = no
alt-php56 = no
alt-php70 = no
alt-php71 = no
alt-php72 = yes
Q. I don’t want to use the PHP Selector, but I’d like to select the alt-phpXX version for one account/website. Can I do that?A. Sure. You’ll need to choose the alt-phpXX in the MultiPHP Manager ➔ PHP Version here:
https://www.rise.company/forum/images/imported/2022/07/4.jpg
Please note that the PHP extensions set in the CloudLinux PHP Selector or CloudLinux Manager settings will not work in this case. You will only get the basic extensions that are built-in into a particular PHP version.
Q. I followed this guide, but the PHP version is still not fetched for my website from PHP Selector. What did I miss?A. Make sure to check our Compatibility Matrix (https://docs.cloudlinux.com/limits/#compatibility-matrix). It contains additional information on components that are incompatible with PHP Selector. E.g., you may need to remove mod_ruid2 to use our PHP Selector.
More about PHP Selector’s configurationSetting up the PHP version on customer’s end (in cPanel)It is possible to change the current PHP Version for MultiPHP Manager on the user’s end. Here’s how the settings would look like by default:
https://www.rise.company/forum/images/imported/2022/07/5.jpg
The end-user can change that and select any version, other than Inherited one. Just like with WHM’s MultiPHP Manager, the PHP Selector won’t work correctly in this case. We recommend leaving either PHP Selector or MultiPHP Manager enabled for the end-user. That way, your end-users will have only one place where to configure PHP which will make things easier.
PHP directives and their prioritiesGiven the way cPanel handles the PHP versions, it could be quite confusing to understand which PHP.ini directive will get higher priority over another. Let's discuss it here.
Directives priority - If PHP Selector is enabledIf you use the PHP Selector (and it is configured according to this guide), its options would have the highest priority. You can find them in cPanel ➔ Select PHP Version ➔ Switch to PHP Options.
https://www.rise.company/forum/images/imported/2022/07/3.png
You can add custom php.ini options here too! Check this article (https://docs.cloudlinux.com/cloudlinux_os_components/#individual-php-ini-files) to find out how to do that.
The lower priority would have the php.ini (or .user.ini for some of the PHP handlers) configuration file, but you could also type in the PHP values there.
Directives priority - If PHP Selector isn’t usedIf you haven’t configured the PHP Selector, and you’d like to simply change PHP.ini parameters for particular alt-phpXX or ea-phpXX versions, you could manage them in WHM ➔ MultiPHP INI Editor. cPanel end-user can also customize php.ini directives in cPanel ➔ MultiPHP INI Editor. For more information, read the official documentation here (https://documentation.cpanel.net/display/68Docs/MultiPHP+INI+Editor+for+WHM) and here (https://documentation.cpanel.net/display/74Docs/MultiPHP+INI+Editor+for+cPanel).
PHP Version in the command-line interface (CLI)Shell commands, starting with /usr/bin/php and /usr/local/bin/php would use the same version that you select in the PHP Selector (if it’s already set up). That PHP will also load PHP directives selected in PHP Selector. For example, if we have a setup like this:
https://www.rise.company/forum/images/imported/2022/07/6.jpg
We should get the 7.2 version in the php -v output if nothing was changed in the PHP Selector. This is exactly what we get:
/usr/local/bin/php -v
PHP 7.2.14 (cli) (built: Feb 10 2019 18:20:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.14, Copyright (c) 1999-2018, by Zend Technologies
But if we change the PHP version in the PHP Selector, the php -v output will change as well.
https://www.rise.company/forum/images/imported/2022/07/4.png
/usr/local/bin/php -v
PHP 7.3.2 (cli) (built: Feb 7 2019 13:36:44) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.2, Copyright (c) 1998-2018 Zend Technologies
However, PHP version chosen in MultiPHP Manager can also be applied to console commands /usr/bin/php and /usr/local/bin/php . Whether it will be applied or not depends on the current working directory. .htaccess file search is performed in the current directory and in parent directories. If the file is found, then the PHP version specified in it is applied, if not found, then System default PHP version is applied. System default PHP version for a specific user can be changed via PHP Selector.