<?php
							 | 
						|
								
							 | 
						|
								namespace App\Commands;
							 | 
						|
								
							 | 
						|
								use Illuminate\Console\Scheduling\Schedule;
							 | 
						|
								use LaravelZero\Framework\Commands\Command;
							 | 
						|
								use Illuminate\Support\Facades\File;
							 | 
						|
								
							 | 
						|
								use App\Facades\Install;
							 | 
						|
								
							 | 
						|
								use Log;
							 | 
						|
								
							 | 
						|
								class InstallPhpFpmCommand extends Command
							 | 
						|
								{
							 | 
						|
								    /**
							 | 
						|
								     * The signature of the command.
							 | 
						|
								     *
							 | 
						|
								     * @var string
							 | 
						|
								     */
							 | 
						|
								    protected $signature = 'install:php-fpm';
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * The description of the command.
							 | 
						|
								     *
							 | 
						|
								     * @var string
							 | 
						|
								     */
							 | 
						|
								    protected $description = 'Install php-fpm';
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * Execute the console command.
							 | 
						|
								     *
							 | 
						|
								     * @return mixed
							 | 
						|
								     */
							 | 
						|
								    public function handle()
							 | 
						|
								    {
							 | 
						|
								        //$option = $this->menu('Install')
							 | 
						|
								        //    ->addOption('nginx', 'Nginx')
							 | 
						|
								        //    ->open();
							 | 
						|
								
							 | 
						|
								        //File::put('/etc/kkk', '/etc/kkk');
							 | 
						|
								
							 | 
						|
								        //$workers = exec('echo $(grep ^processor /proc/cpuinfo | wc -l)');
							 | 
						|
								        //$
							 | 
						|
								        //$
							 | 
						|
								        $this->info('Install PHP FPM');
							 | 
						|
								
							 | 
						|
								        exec('apt update 2>&1');
							 | 
						|
								        exec('apt install -y php-fpm php-curl php-mysql php-pear php-mbstring php-dev php-gd 2>&1');
							 | 
						|
								
							 | 
						|
								        if (Install::isReady('nginx')) {
							 | 
						|
								
							 | 
						|
								            // get status of nginx
							 | 
						|
								            exec('nginx -v 2>&1', $output);
							 | 
						|
								            $status = "$output[0] installed";
							 | 
						|
								
							 | 
						|
								            $this->info($status);
							 | 
						|
								            Log::info($status);
							 | 
						|
								        }
							 | 
						|
								    }
							 | 
						|
								}
							 |