#!/bin/bash #################################################################################################### #### author: SlickStack ############################################################################ #### link: https://slickstack.io ################################################################### #### mirror: http://mirrors.slickstack.io/bash/ss-perms-php.txt #################################### #### path: /var/www/ss-perms-php ################################################################### #### destination: n/a (not a boilerplate) ########################################################## #### purpose: Resets all file and user permissions across the entire PHP-FPM module ################ #### module version: PHP-FPM 7.4.x ################################################################# #### sourced by: ss-perms, ss-install-php ########################################################## #### bash aliases: ss perms php, ss perms php-fpm ################################################## #################################################################################################### ## include SlickStack configuration ## source /var/www/ss-config ## include SlickStack functions ## source /var/www/ss-functions #################################################################################################### #### SS-Clean-Files: Message (Begin Script) ######################################################## #################################################################################################### ## this is a simple message that announces to the shell the purpose of this bash script ## ## it will only be noticed by sudo users who manually call ss core bash scripts ## ## echo message ## echo -e "${PURPLE}Running ss-perms-php: Resets all file and user permissions across the entire PHP-FPM module... ${NOCOLOR}" sleep "$SLEEP_MESSAGE_BEGIN" #################################################################################################### #### SS-Perms-PHP: Reset Permissions (PHP-FPM) ##################################################### #################################################################################################### mkdir /var/run/php # chown www-data:www-data /var/run/php chown root:root /etc/php/7.2/fpm/php.ini &> /dev/null chown root:root /etc/php/7.2/fpm/php-fpm.conf &> /dev/null chown root:root /etc/php/7.2/cli/php.ini &> /dev/null chown root:root /etc/php/7.4/fpm/php.ini &> /dev/null chown root:root /etc/php/7.4/fpm/php-fpm.conf &> /dev/null chown root:root /etc/php/7.4/cli/php.ini &> /dev/null ## reset permissions ## chown root:root /etc/php/7.4/fpm/php-fpm.conf chown root:root /etc/php/7.4/fpm/php.ini chown root:root /etc/php/7.4/cli/php.ini chown root:root /etc/php/7.4/fpm/pool.d/www.conf if [ ! -f "/var/www/logs/error.log" ]; then touch "/var/www/logs/error.log"; fi chown www-data:www-data /var/www/logs/error*.log* chmod 0644 /var/www/logs/*.log ## 6755 should also work #################################################################################################### #### SS-Perms-PHP: Touch Timestamp File (End Script) ############################################### #################################################################################################### ## this is a dummy timestamp file that will remember the last time this script was run ## ## it can be useful for developer reference and is sometimes used by SlickStack ## ## script timestamp ## touch /var/www/meta/.timestamp-ss-perms-php #################################################################################################### #### SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ############### #################################################################################################### ## Ref: ## SS_EOF