-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenable_php7.sh
More file actions
executable file
·21 lines (15 loc) · 944 Bytes
/
enable_php7.sh
File metadata and controls
executable file
·21 lines (15 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# Enable PHP7 & disable PHP8
# write permissions needed on /etc/httpd/conf/httpd.conf
# disable php8
sed -i '/Include conf\/extra\/php_module.conf/c\#Include conf\/extra\/php_module.conf' /etc/httpd/conf/httpd.conf
sed -i '/LoadModule php_module modules\/libphp.so/c\#LoadModule php_module modules\/libphp.so' /etc/httpd/conf/httpd.conf
sed -i '/AddHandler php-script .php/c\#AddHandler php-script .php' /etc/httpd/conf/httpd.conf
#enable php7
sed -i '/#Include conf\/extra\/php7_module.conf/c\Include conf\/extra/php7_module.conf' /etc/httpd/conf/httpd.conf
sed -i '/#LoadModule php7_module modules\/libphp7.so/c\LoadModule php7_module modules\/libphp7.so' /etc/httpd/conf/httpd.conf
sed -i '/#AddHandler php7-script .php/c\AddHandler php7-script .php' /etc/httpd/conf/httpd.conf
# restart apache
# nopasswd in sudoers must be specified !
sudo systemctl restart httpd.service
DISPLAY=:0 notify-send "PHP7 enabled." -u normal