Skip to content

Instantly share code, notes, and snippets.

@cristiroma
Created July 7, 2023 14:04
Show Gist options
  • Save cristiroma/49b30f841cb8faa14a818bb136c7c2fa to your computer and use it in GitHub Desktop.
Save cristiroma/49b30f841cb8faa14a818bb136c7c2fa to your computer and use it in GitHub Desktop.
sudo configuration for PHP developers
# Allow any user to restart apache without password
ALL ALL = NOPASSWD:/usr/bin/systemctl restart apache2
ALL ALL = NOPASSWD:/usr/bin/systemctl restart nginx
Cmnd_Alias PHP = /usr/bin/update-alternatives --config php, /usr/bin/update-alternatives --set php /usr/bin/php5.6, /usr/bin/update-alternatives --set php-config /usr/bin/php-config5.6, /usr/bin/update-alternatives --set phpize /usr/bin/phpize5.6, /usr/bin/update-alternatives --set php /usr/bin/php7.4, /usr/bin/update-alternatives --set php-config /usr/bin/php-config7.4, /usr/bin/update-alternatives --set phpize /usr/bin/phpize7.4, /usr/bin/update-alternatives --set php /usr/bin/php7.1, /usr/bin/update-alternatives --set php-config /usr/bin/php-config7.1, /usr/bin/update-alternatives --set phpize /usr/bin/phpize7.1, /usr/bin/update-alternatives --set php /usr/bin/php7.4, /usr/bin/update-alternatives --set php-config /usr/bin/php-config7.4, /usr/bin/update-alternatives --set phpize /usr/bin/phpize7.4, /usr/bin/update-alternatives --set php /usr/bin/php8.1, /usr/bin/update-alternatives --set php-config /usr/bin/php-config8.1, /usr/bin/update-alternatives --set phpize /usr/bin/phpize8.1, /usr/bin/systemctl restart php5.6-fpm, /usr/bin/systemctl restart php7.1-fpm, /usr/bin/systemctl restart php7.4
-fpm, /usr/bin/systemctl restart php8.1-fpm
ALL ALL = NOPASSWD:PHP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment