Skip to content

Commit

Permalink
Merge pull request YunoHost#110 from YunoHost/set_php_version
Browse files Browse the repository at this point in the history
Set the default php version to use
  • Loading branch information
yalh76 authored May 30, 2020
2 parents 98ad06a + ba90882 commit 6e2e6d0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ location __PATH__/ {
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;

fastcgi_index index.php;
include fastcgi_params;
Expand Down
2 changes: 1 addition & 1 deletion conf/php-fpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ group = __USER__
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock
listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock

; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
Expand Down
2 changes: 1 addition & 1 deletion scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#=================================================

# dependencies used by the app
pkg_dependencies="deb1 deb2"
pkg_dependencies="deb1 deb2 php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP_VERSION-deb2"

#=================================================
# PERSONAL HELPERS
Expand Down
3 changes: 2 additions & 1 deletion scripts/backup
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)

#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
Expand Down Expand Up @@ -58,7 +59,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================

ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"

#=================================================
# BACKUP FAIL2BAN CONFIGURATION
Expand Down
5 changes: 3 additions & 2 deletions scripts/restore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)

#=================================================
# CHECK IF THE APP CAN BE RESTORED
Expand Down Expand Up @@ -78,7 +79,7 @@ chown -R root: $final_path
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================

ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"

#=================================================
# RESTORE FAIL2BAN CONFIGURATION
Expand Down Expand Up @@ -148,7 +149,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1

ynh_systemd_action --service_name=php7.0-fpm --action=reload
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload

#=================================================
Expand Down

0 comments on commit 6e2e6d0

Please sign in to comment.