summaryrefslogtreecommitdiffstats
path: root/wizard/index.php
blob: e412553f38919582cd2fe8c4293e9cd9a6b60ef0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta content="text/html; charset=utf-8" http-equiv="content-type" />
		<title>Remi's RPM repository</title>
		<link href="../enterprise/7/remi/x86_64/repoview/layout/repostyle.css" type="text/css" rel="stylesheet" />
		<meta content="index,follow" name="robots" />
		<link rel="shortcut icon" href="/favicon.ico" />
</head>
<?php
define('FC_EOL', 21);
define('EL_EOL', 4);
define('COUNTER', __DIR__ . "/counter.txt");

$osvers = [
    'RHEL 7'    => '5.4',
    'RHEL 6'    => '5.3',
    'RHEL 5'    => '5.1',
    'CentOS 7'  => '5.4',
    'CentOS 6'  => '5.3',
    'CentOS 5'  => '5.1',
    'Fedora 23' => '5.6',
    'Fedora 22' => '5.6',
    'Fedora 21' => '5.6',
];
$types = [
    'base' => 'Single version',
    'scl'  => 'Multiple versions', 
];
$phpvers = [
    '7.0' => 'remi-php70',
    '5.6' => 'remi-php56',
    '5.5' => 'remi-php55',
    '5.4' => 'remi',
];
$php  = (isset($_POST['php'])  && isset($phpvers[$_POST['php']]) ? $_POST['php'] : false);
$os   = (isset($_POST['os'])   && isset($osvers[$_POST['os']])   ? $_POST['os'] : false);
$type = (isset($_POST['type']) && isset($types[$_POST['type']])  ? $_POST['type'] : false);

?>
<body>
	<div id="page">
		<div id="top">
			<h1><span><a href="/">Remi's RPM repository - Configuration wizard</a></span></h1>
		</div>
		<p id="prelude">
			<a href="http://blog.remirepo.net/">Blog</a> | 
			<a href="http://forum.remirepo.net/">Forums</a> | 
			<a href="http://rpms.remirepo.net/">Repository</a>
		</p>
		<div id="wrapper">
			<div id="main">
				<div id="content">
                                    <h2>Operating system and version selection</h2>
                                    <form method='post'>
                                    <ul class="pkglist">
                                    <li><p>Operating system:
                                        <select name='os' onChange='submit()'>
                                        <option value=''>--</option>
<?php
                                        $prev = false;
                                        foreach($osvers as $osver => $phpver) {
                                            list($dist, $ver) = explode(' ', $osver, 2);
                                            if ($dist != $prev) {
                                                if ($prev) echo "</optgroup>";
                                                printf("<optgroup label='%s'>", $prev=$dist);
                                            }
                                            printf("<option value='%s' %s>&nbsp;&nbsp;&nbsp;&nbsp;%s</option>", $osver, ($osver===$os ? 'selected' : ''), $osver);
                                        }
?>
                                        </optgroup></select>
                                    </p></li>
                                    <li><p>PHP version:
                                        <select name='php' onChange='submit()'>
                                        <option value=''>--</option>
<?php
                                        foreach($phpvers as $phpver => $repo) printf("<option value='%s' %s>%s</option>", $phpver, ($phpver===$php ? 'selected' : ''), $phpver);
?>
                                        </select>
                                    </p></li>
                                    <li><p>Type of installation:
                                        <select name='type' onChange='submit()'>
                                        <option value=''>--</option>
<?php
                                        foreach($types as $typeref => $name) printf("<option value='%s' %s>%s</option>", $typeref, ($typeref===$type ? 'selected' : ''), $name);
?>
                                        </select>
                                    </p></li>
                                    </ul>
                                    </form>
                                    <h2>Wizard answer</h2>
                                    <ul class="pkglist">
<?php
$counter = intval(@file_get_contents(COUNTER));

//printf("<p>Debug: $os, $type, $php (%s)</p>", print_r($_POST, true));
$err = false;
if ($os) {
    list($dist, $ver) = explode(' ', $os, 2);    
    if (($dist == 'Fedora' && $ver<=FC_EOL) || ($dist != 'Fedora' && $ver<=EL_EOL)) {
        printf("<li><b>%s</b> have reached its <b>end of life</b>, upgrade is strongly recommended.</li><br />", $os);
    }
}
if ($php && $os) {
    printf("<li><b>%s</b> provides PHP version <b>%s</b> in its official repository</li><br />", $os, $osvers[$os]);

    if ($ver < 6 && version_compare($php, '7.0', '>=')) {
        printf("<li>Sorry, but PHP version <b>%s</b> is not available for <b>%s</b>, you need to run a more recent OS.</li><br />", $php, $os);
        $err = true;
    }
}
if ($php && $os && $type && !$err) {
    if ($dist == 'Fedora') {
        $yum = 'dnf';
        printf("<li>Command to install the Remi repository configuration package:");
        printf("<pre>    $yum install http://rpms.remirepo.net/fedora/remi-release-%d.rpm</pre>", $ver);
        printf("</li><br />");
    
    } else {
        $yum = 'yum';
        printf("<li>Command to install the EPEL repository configuration package:");
        if ($ver < 6) {
            printf("<pre>    wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-%d.noarch.rpm\n", $ver);
            printf("    $yum install epel-release-latest-%d.noarch.rpm\n", $ver);
            printf("</li><br /><li>Command to install the Remi repository configuration package:");
            printf("<pre>    wget http://rpms.remirepo.net/enterprise/remi-release-%d.rpm\n", $ver);
            printf("    $yum install http://rpms.remirepo.net/enterprise/remi-release-%d.rpm</pre>", $ver);
        } else {
            printf("<pre>    $yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-%d.noarch.rpm</pre>", $ver);
            printf("</li><br /><li>Command to install the Remi repository configuration package:");
            printf("<pre>    $yum install http://rpms.remirepo.net/enterprise/remi-release-%d.rpm</pre>", $ver);
        }
        printf("</li><br />");
        if ($dist == 'RHEL') {
            printf("<li>On <b>RHEL</b> you (probably) need to enable the <b>optional channel</b> for some dependencies.</li><br />");
            printf("</li><li>Command to enable:");
            if ($ver == 7) {
                printf("<pre>    subscription-manager repos --enable=rhel-7-server-optional-rpms</pre>");
            } else {
                printf("<pre>    rhn-channel --add --channel=rhel-$(uname -i)-server-optional-6</pre>");
            }
            printf("</li><br />");
        }
    }
    if ($type == 'base') {
        printf("<li>You want a <b>single version </b> which means replacing base packages from the distribution</li><br />");

        if (version_compare($php, $osvers[$os], '<')) {
            printf("<li>Sorry, but PHP version older than <b>%s</b> are not available for <b>%s</b>, try multiple versions.</li><br />", $osvers[$os], $os);

        } else if (version_compare($php, $osvers[$os], '=')) {
            printf("<li>PHP version <b>%s</b> packages are available for <b>%s</b> in <b>remi</b> repository</li><br />", $php, $os);
            printf("<li>Command to upgrade:");
            printf("<pre>    $yum --enablerepo=remi update 'php*'</pre>");
            printf("</li><br />");
            printf("<li>Command to install additional packages:");
            printf("<pre>    $yum --enablerepo=remi install php-xxx</pre>");
            printf("</li><br />");

        } else {
            printf("<li>PHP version <b>%s</b> packages are available for <b>%s</b> in <b>%s</b> repository</li><br />", $php, $os, $phpvers[$php]);
            if ($ver < 6) {
                printf("<li>You have to enable the repository by setting <b>enabled=1</b> in the [%s] section of /etc/yum.repos.d/remi.repo", $phpvers[$php]);
            } else {
                printf("<li>Command to enable the repository:");
                if ($dist == 'Fedora') {
                        printf("<pre>    dnf config-manager --enable %s</pre>", $phpvers[$php]);
                } else {
                        printf("<pre>    yum-config-manager --enable %s</pre>", $phpvers[$php]);
                }
            }
            printf("</li><br />");
            printf("<li>Command to upgrade (the repository only provides PHP):");
            printf("<pre>    $yum update</pre>");
            printf("</li><br />");
            printf("<li>Command to install additional packages:");
            printf("<pre>    $yum install php-xxx</pre>");
            printf("</li><br />");
            printf("<li>Command to check the installed version and available extensions:");
            printf("<pre>    php --version\n    php --modules</pre>");
            printf("</li><br />");
        }
        $counter++;
        @file_put_contents(COUNTER, "$counter\n");
    } else {
        printf("<li>You want <b>multiple versions </b> which means using a <a href='https://www.softwarecollections.org/en/'>Software Collection</a></li><br />");
        $scl='php'.str_replace('.', '', $php);
        
        if ($dist=='Fedora' || version_compare($php, '5.6', '<')) {
            printf("<li>The <b>%s</b> collection is available in the <b>remi</b> repository</li><br />", $scl);
            printf("<li>Command to install:");
            printf("<pre>    $yum --enablerepo=remi install %s</pre>", $scl);
            printf("</li><br />");
            printf("<li>Command to install additional packages:");
            printf("<pre>    $yum --enablerepo=remi install %s-php-xxx</pre>", $scl);
            printf("</li><br />");
        } else {
            printf("<li>The <b>%s</b> collection is available in the <b>remi-safe</b> repository</li><br />", $scl);
            printf("<li>Command to install:");
            printf("<pre>    $yum install %s</pre>", $scl);
            printf("</li><br />");
            printf("<li>Command to install additional packages:");
            printf("<pre>    $yum install %s-php-xxx</pre>", $scl);
            printf("</li><br />");
        }
        printf("<li>Command to check the installed version and available extensions:");
        printf("<pre>    %s --version\n    %s --modules</pre>", $scl, $scl);
        printf("</li><br />");
        $counter++;
        @file_put_contents(COUNTER, "$counter\n");
    }
} else if (!$os) {
    echo "<li><p>Please select the operating system you are running.</p></li>";

} else if (!$php) {
    echo "<li><p>Please select PHP version you want to use.</p></li>";

} else if (!$err) {
    echo "<li><p>Please select installation type</p></li>";
}
?>
                                    </ul>
                                </div>
			</div>
			<div id="sidebar">
				<h2>More information</h2>
				<ul class="levbarlist">
					<li><a href="http://blog.remirepo.net/pages/Config-en" class="nlink" title="Repository configuration">Repository configuration</a></li>
					<li><a href="http://blog.remirepo.net/pages/English-FAQ"  class="nlink" title="F.A.Q.">F.A.Q.</a></li>
					<li><?php
					printf("<b>%d answers</b> given", $counter);
					?></li>
				</ul><br /><br /><br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div>
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHLwYJKoZIhvcNAQcEoIIHIDCCBxwCAQExggEwMIIBLAIBADCBlDCB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w0BCQUxDxcNMTAwNjA0MDU1NTEwWjAjBgkqhkiG9w0BCQQxFgQUo6DkEDxwjY+LFKOw0Vcxh7zRkPYwDQYJKoZIhvcNAQEBBQAEgYCzm9l6X7egJAMom1ZVdV1MqM30cxNGrQeQNQhgj8NnNs4N8uJ+sGeEXDlLdkkUJS4mUlAG6JwvOcCGr++NJUF+qmpQmX7YzbjBnt3pnWfcCrtYVkgCg/d0M+0ZEWTQEP3aMqIL/zeg70LYhg4/kgfR2jrN2IwxkChLoiZi6bQulQ==-----END PKCS7-----
" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" />
<img alt="" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" width="1" height="1" />
</div></form>

			</div>
		</div>
	        <hr style="clear:both;"/>
	        
	</div>
</body>
</html>