|
0
|
1 |
<?php |
|
|
2 |
|
|
|
3 |
if (!isset($_SERVER['HTTP_HOST'])) { |
|
|
4 |
exit('This script cannot be run from the CLI. Run it from a browser.'); |
|
|
5 |
} |
|
|
6 |
|
|
|
7 |
if (!in_array(@$_SERVER['REMOTE_ADDR'], array( |
|
|
8 |
'127.0.0.1', |
|
|
9 |
'::1', |
|
|
10 |
))) { |
|
|
11 |
header('HTTP/1.0 403 Forbidden'); |
|
|
12 |
exit('This script is only accessible from localhost.'); |
|
|
13 |
} |
|
|
14 |
|
|
|
15 |
$majorProblems = array(); |
|
|
16 |
$minorProblems = array(); |
|
|
17 |
$phpini = false; |
|
|
18 |
|
|
|
19 |
// minimum |
|
|
20 |
if (!version_compare(phpversion(), '5.3.2', '>=')) { |
|
|
21 |
$version = phpversion(); |
|
|
22 |
$majorProblems[] = <<<EOF |
|
|
23 |
You are running PHP version "<strong>$version</strong>", but Symfony |
|
|
24 |
needs at least PHP "<strong>5.3.2</strong>" to run. Before using Symfony, install |
|
|
25 |
PHP "<strong>5.3.2</strong>" or newer. |
|
|
26 |
EOF; |
|
|
27 |
} |
|
|
28 |
|
|
|
29 |
if (!is_writable(__DIR__ . '/../app/cache')) { |
|
|
30 |
$majorProblems[] = 'Change the permissions of the "<strong>app/cache/</strong>" |
|
|
31 |
directory so that the web server can write into it.'; |
|
|
32 |
} |
|
|
33 |
|
|
|
34 |
if (!is_writable(__DIR__ . '/../app/logs')) { |
|
|
35 |
$majorProblems[] = 'Change the permissions of the "<strong>app/logs/</strong>" |
|
|
36 |
directory so that the web server can write into it.'; |
|
|
37 |
} |
|
|
38 |
|
|
|
39 |
// extensions |
|
|
40 |
if (!class_exists('DomDocument')) { |
|
|
41 |
$minorProblems[] = 'Install and enable the <strong>php-xml</strong> module.'; |
|
|
42 |
} |
|
|
43 |
|
|
|
44 |
if (!defined('LIBXML_COMPACT')) { |
|
|
45 |
$minorProblems[] = 'Upgrade your <strong>php-xml</strong> extension with a newer libxml.'; |
|
|
46 |
} |
|
|
47 |
|
|
|
48 |
if (!((function_exists('apc_store') && ini_get('apc.enabled')) || function_exists('eaccelerator_put') && ini_get('eaccelerator.enable') || function_exists('xcache_set'))) { |
|
|
49 |
$minorProblems[] = 'Install and enable a <strong>PHP accelerator</strong> like APC (highly recommended).'; |
|
|
50 |
} |
|
|
51 |
|
|
|
52 |
if (!(!(function_exists('apc_store') && ini_get('apc.enabled')) || version_compare(phpversion('apc'), '3.0.17', '>='))) { |
|
|
53 |
$majorProblems[] = 'Upgrade your <strong>APC</strong> extension (3.0.17+)'; |
|
|
54 |
} |
|
|
55 |
|
|
|
56 |
if (!function_exists('token_get_all')) { |
|
|
57 |
$minorProblems[] = 'Install and enable the <strong>Tokenizer</strong> extension.'; |
|
|
58 |
} |
|
|
59 |
|
|
|
60 |
if (!function_exists('mb_strlen')) { |
|
|
61 |
$minorProblems[] = 'Install and enable the <strong>mbstring</strong> extension.'; |
|
|
62 |
} |
|
|
63 |
|
|
|
64 |
if (!function_exists('iconv')) { |
|
|
65 |
$minorProblems[] = 'Install and enable the <strong>iconv</strong> extension.'; |
|
|
66 |
} |
|
|
67 |
|
|
|
68 |
if (!function_exists('utf8_decode')) { |
|
|
69 |
$minorProblems[] = 'Install and enable the <strong>XML</strong> extension.'; |
|
|
70 |
} |
|
|
71 |
|
|
|
72 |
if (PHP_OS != 'WINNT' && !function_exists('posix_isatty')) { |
|
|
73 |
$minorProblems[] = 'Install and enable the <strong>php_posix</strong> extension (used to colorize the CLI output).'; |
|
|
74 |
} |
|
|
75 |
|
|
|
76 |
if (!class_exists('Locale')) { |
|
|
77 |
$minorProblems[] = 'Install and enable the <strong>intl</strong> extension.'; |
|
|
78 |
} else { |
|
|
79 |
$version = ''; |
|
|
80 |
|
|
|
81 |
if (defined('INTL_ICU_VERSION')) { |
|
|
82 |
$version = INTL_ICU_VERSION; |
|
|
83 |
} else { |
|
|
84 |
$reflector = new \ReflectionExtension('intl'); |
|
|
85 |
|
|
|
86 |
ob_start(); |
|
|
87 |
$reflector->info(); |
|
|
88 |
$output = strip_tags(ob_get_clean()); |
|
|
89 |
|
|
|
90 |
preg_match('/^ICU version (.*)$/m', $output, $matches); |
|
|
91 |
$version = $matches[1]; |
|
|
92 |
} |
|
|
93 |
|
|
|
94 |
if (!version_compare($version, '4.0', '>=')) { |
|
|
95 |
$minorProblems[] = 'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'; |
|
|
96 |
} |
|
|
97 |
} |
|
|
98 |
|
|
|
99 |
if (!class_exists('SQLite3') && !in_array('sqlite', PDO::getAvailableDrivers())) { |
|
|
100 |
$majorProblems[] = 'Install and enable the <strong>SQLite3</strong> or <strong>PDO_SQLite</strong> extension.'; |
|
|
101 |
} |
|
|
102 |
|
|
|
103 |
if (!function_exists('json_encode')) { |
|
|
104 |
$majorProblems[] = 'Install and enable the <strong>json</strong> extension.'; |
|
|
105 |
} |
|
|
106 |
|
|
|
107 |
if (!function_exists('session_start')) { |
|
|
108 |
$majorProblems[] = 'Install and enable the <strong>session</strong> extension.'; |
|
|
109 |
} |
|
|
110 |
|
|
|
111 |
if (!function_exists('ctype_alpha')) { |
|
|
112 |
$majorProblems[] = 'Install and enable the <strong>ctype</strong> extension.'; |
|
|
113 |
} |
|
|
114 |
|
|
|
115 |
// php.ini |
|
|
116 |
if (!ini_get('date.timezone')) { |
|
|
117 |
$phpini = true; |
|
|
118 |
$majorProblems[] = 'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'; |
|
|
119 |
} |
|
|
120 |
|
|
|
121 |
if (ini_get('short_open_tag')) { |
|
|
122 |
$phpini = true; |
|
|
123 |
$minorProblems[] = 'Set <strong>short_open_tag</strong> to <strong>off</strong> in php.ini<a href="#phpini">*</a>.'; |
|
|
124 |
} |
|
|
125 |
|
|
|
126 |
if (ini_get('magic_quotes_gpc')) { |
|
|
127 |
$phpini = true; |
|
|
128 |
$minorProblems[] = 'Set <strong>magic_quotes_gpc</strong> to <strong>off</strong> in php.ini<a href="#phpini">*</a>.'; |
|
|
129 |
} |
|
|
130 |
|
|
|
131 |
if (ini_get('register_globals')) { |
|
|
132 |
$phpini = true; |
|
|
133 |
$minorProblems[] = 'Set <strong>register_globals</strong> to <strong>off</strong> in php.ini<a href="#phpini">*</a>.'; |
|
|
134 |
} |
|
|
135 |
|
|
|
136 |
if (ini_get('session.auto_start')) { |
|
|
137 |
$phpini = true; |
|
|
138 |
$minorProblems[] = 'Set <strong>session.auto_start</strong> to <strong>off</strong> in php.ini<a href="#phpini">*</a>.'; |
|
|
139 |
} |
|
|
140 |
?> |
|
|
141 |
<!DOCTYPE html> |
|
|
142 |
<html> |
|
|
143 |
<head> |
|
|
144 |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
|
|
145 |
<link href="bundles/sensiodistribution/webconfigurator/css/install.css" rel="stylesheet" type="text/css" media="all" /> |
|
|
146 |
<title>Symfony Configuration</title> |
|
|
147 |
</head> |
|
|
148 |
<body> |
|
|
149 |
<div id="symfony-wrapper"> |
|
|
150 |
<div id="symfony-content"> |
|
|
151 |
<div class="symfony-blocks-install"> |
|
|
152 |
<div class="symfony-block-logo"> |
|
|
153 |
<img src="bundles/sensiodistribution/webconfigurator/images/logo-big.gif" alt="sf_symfony" /> |
|
|
154 |
</div> |
|
|
155 |
|
|
|
156 |
<div class="symfony-block-content"> |
|
|
157 |
<h1>Welcome!</h1> |
|
|
158 |
<p>Welcome to your new Symfony project.</p> |
|
|
159 |
<p>This script will guide you through the basic configuration of your project. You can also do the same by editing the ‘<strong>app/config/parameters.ini</strong>’ file directly.</p> |
|
|
160 |
|
|
|
161 |
<?php if (count($majorProblems)): ?> |
|
|
162 |
<h2> |
|
|
163 |
<span><?php echo count($majorProblems) ?> Major problems</span> |
|
|
164 |
</h2> |
|
|
165 |
<p>Major problems have been detected and <strong>must</strong> be fixed before continuing :</p> |
|
|
166 |
<ol> |
|
|
167 |
<?php foreach ($majorProblems as $problem): ?> |
|
|
168 |
<li><?php echo $problem; ?></li> |
|
|
169 |
<?php endforeach ?> |
|
|
170 |
</ol> |
|
|
171 |
<?php endif ?> |
|
|
172 |
|
|
|
173 |
<?php if (count($minorProblems)): ?> |
|
|
174 |
<h2>Recommendations</h2> |
|
|
175 |
<p> |
|
|
176 |
<?php if ($majorProblems): ?> |
|
|
177 |
Additionally, to |
|
|
178 |
<?php else: ?> |
|
|
179 |
To<?php endif; ?> |
|
|
180 |
enhance your Symfony experience, it’s recommended that you fix the following : |
|
|
181 |
</p> |
|
|
182 |
<ol> |
|
|
183 |
<?php foreach ($minorProblems as $problem): ?> |
|
|
184 |
<li><?php echo $problem; ?></li> |
|
|
185 |
<?php endforeach; ?> |
|
|
186 |
</ol> |
|
|
187 |
<?php endif ?> |
|
|
188 |
|
|
|
189 |
<?php if ($phpini): ?> |
|
|
190 |
<a id="phpini"></a> |
|
|
191 |
<p>* |
|
|
192 |
<?php if (get_cfg_var('cfg_file_path')): ?> |
|
|
193 |
Changes to the <strong>php.ini</strong> file must be done in "<strong><?php echo get_cfg_var('cfg_file_path') ?></strong>". |
|
|
194 |
<?php else: ?> |
|
|
195 |
To change settings, create a "<strong>php.ini</strong>". |
|
|
196 |
<?php endif; ?> |
|
|
197 |
</p> |
|
|
198 |
</div> |
|
|
199 |
<?php endif; ?> |
|
|
200 |
|
|
|
201 |
<ul class="symfony-install-continue"> |
|
|
202 |
<?php if (!count($majorProblems)): ?> |
|
|
203 |
<li><a href="app_dev.php/_configurator/">Configure your Symfony Application online</a></li> |
|
|
204 |
<li><a href="app_dev.php/">Bypass configuration and go to the Welcome page</a></li> |
|
|
205 |
<?php endif ?> |
|
|
206 |
<li><a href="config.php">Re-check configuration</a></li> |
|
|
207 |
</ul> |
|
|
208 |
</div> |
|
|
209 |
</div> |
|
|
210 |
</div> |
|
|
211 |
<div class="version">Symfony Standard Edition</div> |
|
|
212 |
</body> |
|
|
213 |
</html> |