Browse Source

adding #41

release/0.2
Björn 4 years ago
parent
commit
f424d0aca6
2 changed files with 16 additions and 14 deletions
  1. +14
    -12
      app/Commands/PhpFpmInstallCommand.php
  2. +2
    -2
      app/Helpers/InstallHelper.php

+ 14
- 12
app/Commands/PhpFpmInstallCommand.php View File

@ -46,6 +46,8 @@ class PhpFpmInstallCommand extends Command
{ {
$this->info('Php-fpm installing...'); $this->info('Php-fpm installing...');
$output = [];
exec('apt update 2>&1', $output); exec('apt update 2>&1', $output);
exec('apt install -y php-fpm '.self::PACKAGES.' 2>&1', $output); exec('apt install -y php-fpm '.self::PACKAGES.' 2>&1', $output);
@ -64,24 +66,24 @@ class PhpFpmInstallCommand extends Command
$user = $this->option('user'); $user = $this->option('user');
if ($user) { if ($user) {
$output = [];
$this->info('Php-fpm change user...'); $this->info('Php-fpm change user...');
exec('sed -i "s/user = www-data/user = '.$user.'/g" '.$file, $output);
exec('sed -i "s/group = www-data/group = '.$user.'/g" '.$file, $output);
system('sed -i "s/user = www-data/user = '.$user.'/g" '.$file);
system('sed -i "s/group = www-data/group = '.$user.'/g" '.$file);
exec('sed -i "s/listen.owner = www-data/listen.owner = '.$user.'/g" '.$file, $output);
exec('sed -i "s/listen.group = www-data/listen.group = '.$user.'/g" '.$file, $output);
$this->line(implode("\n", $output));
system('sed -i "s/listen.owner = www-data/listen.owner = '.$user.'/g" '.$file);
system('sed -i "s/listen.group = www-data/listen.group = '.$user.'/g" '.$file);
} }
$output = [];
$this->info('Php-fpm change mode...'); $this->info('Php-fpm change mode...');
exec('sed -i "s/;listen.mode = 0660/listen.mode = 0660/g" '.$file, $output);
system('sed -i "s/;listen.mode = 0660/listen.mode = 0660/g" '.$file);
// getting version and restart service
$output = [];
exec("systemctl --full --type service --all | awk '{print $1}' | egrep php.+?fpm.service", $output);
$this->line(implode("\n", $output));
foreach ($output as $line) {
system('service '.str_replace('.service', '', $line).' restart');
}
} }
} }


+ 2
- 2
app/Helpers/InstallHelper.php View File

@ -30,7 +30,7 @@ class InstallHelper
{ {
$result = false; $result = false;
exec('echo $(dpkg -s nginx 2>&1 | grep "'.self::PACKAGE_STATUS.'")', $output);
exec('echo $(dpkg -s '.$name.' 2>&1 | grep "'.self::PACKAGE_STATUS.'")', $output);
if (isset($output[0]) && $output[0] === self::PACKAGE_STATUS) { if (isset($output[0]) && $output[0] === self::PACKAGE_STATUS) {
$result = true; $result = true;
@ -59,7 +59,7 @@ class InstallHelper
} }
/** /**
*
*
* *
* @return string * @return string
*/ */


Loading…
Cancel
Save