Skip to content

Commit 225f9be

Browse files
Update PHPInstaller.php
1 parent 538adb7 commit 225f9be

File tree

1 file changed

+45
-31
lines changed

1 file changed

+45
-31
lines changed

web/app/Installers/Server/Applications/PHPInstaller.php

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,61 @@ public function install()
3636
$commands[] = 'add-apt-repository -y ppa:ondrej/php';
3737
$commands[] = 'add-apt-repository -y ppa:ondrej/apache2';
3838

39-
$dependenciesList = [
39+
40+
$apacheCommands = [];
41+
$apacheCommands[] = 'a2enmod cgi';
42+
$apacheCommands[] = 'a2enmod deflate';
43+
$apacheCommands[] = 'a2enmod expires';
44+
$apacheCommands[] = 'a2enmod mime';
45+
$apacheCommands[] = 'a2enmod rewrite';
46+
$apacheCommands[] = 'a2enmod env';
47+
$apacheCommands[] = 'a2enmod ssl';
48+
$apacheCommands[] = 'a2enmod actions';
49+
$apacheCommands[] = 'a2enmod headers';
50+
$apacheCommands[] = 'a2enmod suexec';
51+
$apacheCommands[] = 'a2enmod ruid2';
52+
$apacheCommands[] = 'a2enmod proxy';
53+
$apacheCommands[] = 'a2enmod proxy_http';
54+
55+
// For Fast CGI
56+
// $apacheCommands[] = 'a2enmod fcgid';
57+
// $apacheCommands[] = 'a2enmod alias';
58+
// $apacheCommands[] = 'a2enmod proxy_fcgi';
59+
// $apacheCommands[] = 'a2enmod setenvif';
60+
61+
// $apacheCommands[] = 'ufw allow in "Apache Full"';
62+
63+
64+
$dependenciesListApache = [
4065
'apache2',
4166
'apache2-suexec-custom',
4267
'libapache2-mod-ruid2'
4368
];
69+
70+
$dependenciesApache = implode(' ', $dependenciesListApache);
71+
$commands[] = 'apt-get install -yq ' . $dependenciesApache;
72+
$commands = array_merge($commands, $apacheCommands);
73+
4474
if (!empty($this->phpVersions)) {
4575
foreach ($this->phpVersions as $phpVersion) {
46-
$dependenciesList[] = 'libapache2-mod-php' . $phpVersion;
47-
}
48-
if (!empty($this->phpModules)) {
49-
foreach ($this->phpVersions as $phpVersion) {
50-
$dependenciesList[] = 'php' . $phpVersion;
51-
$dependenciesList[] = 'php' . $phpVersion . '-cgi';
52-
$dependenciesList[] = 'php' . $phpVersion . '-{' . implode(',', $this->phpModules) . '}';
76+
77+
$dependenciesListPHP = [];
78+
$dependenciesListPHP[] = 'php'.$phpVersion;
79+
$dependenciesListPHP[] = 'libapache2-mod-php'.$phpVersion;
80+
$dependenciesListPHP[] = 'php'.$phpVersion;
81+
$dependenciesListPHP[] = 'php'.$phpVersion.'-cgi';
82+
83+
if (!empty($this->phpModules)) {
84+
$dependenciesListPHP[] = 'php'.$phpVersion.'-{'.implode(',',
85+
$this->phpModules).'}';
5386
}
87+
88+
$dependenciesPHP = implode(' ', $dependenciesListPHP);
89+
$commands[] = 'apt-get install -yq '.$dependenciesPHP;
5490
}
55-
}
5691

92+
}
5793

58-
$dependencies = implode(' ', $dependenciesList);
59-
$commands[] = 'apt-get install -yq ' . $dependencies;
6094

6195
$lastItem = end($this->phpVersions);
6296
foreach ($this->phpVersions as $phpVersion) {
@@ -67,27 +101,7 @@ public function install()
67101
}
68102
}
69103

70-
$commands[] = 'a2enmod cgi';
71-
$commands[] = 'a2enmod deflate';
72-
$commands[] = 'a2enmod expires';
73-
$commands[] = 'a2enmod mime';
74-
$commands[] = 'a2enmod rewrite';
75-
$commands[] = 'a2enmod env';
76-
$commands[] = 'a2enmod ssl';
77-
$commands[] = 'a2enmod actions';
78-
$commands[] = 'a2enmod headers';
79-
$commands[] = 'a2enmod suexec';
80-
$commands[] = 'a2enmod ruid2';
81-
$commands[] = 'a2enmod proxy';
82-
$commands[] = 'a2enmod proxy_http';
83-
84-
// For Fast CGI
85-
// $commands[] = 'a2enmod fcgid';
86-
// $commands[] = 'a2enmod alias';
87-
// $commands[] = 'a2enmod proxy_fcgi';
88-
// $commands[] = 'a2enmod setenvif';
89104

90-
// $commands[] = 'ufw allow in "Apache Full"';
91105
$commands[] = 'systemctl restart apache2';
92106
$commands[] = 'phyre-php /usr/local/phyre/web/artisan phyre:run-repair';
93107
$commands[] = 'apt-get autoremove -yq';

0 commit comments

Comments
 (0)