‪TYPO3CMS  9.5
Check.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 
50 class ‪Check implements ‪CheckInterface
51 {
55  protected ‪$messageQueue;
56 
60  protected ‪$requiredPhpExtensions = [
61  'filter',
62  'gd',
63  'hash',
64  'json',
65  'mysqli',
66  'session',
67  'SPL',
68  'standard',
69  'xml',
70  'zip',
71  'zlib',
72  ];
73 
77  protected ‪$suggestedPhpExtensions = [
78  'fileinfo' => 'This extension is used for proper file type detection in the File Abstraction Layer.',
79  'intl' => 'This extension is used for correct language and locale handling.',
80  'openssl' => 'This extension is used for sending SMTP mails over an encrypted channel endpoint, and for extensions such as "rsaauth".'
81  ];
82 
88  public function ‪getStatus(): ‪FlashMessageQueue
89  {
90  $this->messageQueue = new ‪FlashMessageQueue('install');
94  $this->‪checkMemorySettings();
95  $this->‪checkPhpVersion();
96  $this->‪checkMaxExecutionTime();
97  $this->‪checkDisableFunctions();
99  $this->‪checkDocRoot();
100  $this->‪checkOpenBaseDir();
102 
103  $this->‪checkMaxInputVars();
106 
107  foreach ($this->requiredPhpExtensions as $extension) {
108  $this->‪checkPhpExtension($extension);
109  }
110 
111  foreach ($this->suggestedPhpExtensions as $extension => $purpose) {
112  $this->‪checkPhpExtension($extension, false, $purpose);
113  }
114 
115  $this->‪checkPcreVersion();
117  $this->‪checkGdLibGifSupport();
118  $this->‪checkGdLibJpgSupport();
119  $this->‪checkGdLibPngSupport();
121 
122  return ‪$this->messageQueue;
123  }
124 
128  protected function ‪checkCurrentDirectoryIsInIncludePath()
129  {
130  $includePath = ini_get('include_path');
131  $delimiter = $this->‪isWindowsOs() ? ';' : ':';
132  $pathArray = $this->‪trimExplode($delimiter, $includePath);
133  if (!in_array('.', $pathArray)) {
134  $this->messageQueue->enqueue(new ‪FlashMessage(
135  'include_path = ' . implode(' ', $pathArray) . LF
136  . 'Normally the current path \'.\' is included in the'
137  . ' include_path of PHP. Although TYPO3 does not rely on this,'
138  . ' it is an unusual setting that may introduce problems for'
139  . ' some extensions.',
140  'Current directory (./) is not within PHP include path',
142  ));
143  } else {
144  $this->messageQueue->enqueue(new ‪FlashMessage(
145  '',
146  'Current directory (./) is within PHP include path.'
147  ));
148  }
149  }
150 
154  protected function ‪checkFileUploadEnabled()
155  {
156  if (!ini_get('file_uploads')) {
157  $this->messageQueue->enqueue(new ‪FlashMessage(
158  'file_uploads=' . ini_get('file_uploads') . LF
159  . 'TYPO3 uses the ability to upload files from the browser in various cases.'
160  . ' If this flag is disabled in PHP, you won\'t be able to upload files.'
161  . ' But it doesn\'t end here, because not only are files not accepted by'
162  . ' the server - ALL content in the forms are discarded and therefore'
163  . ' nothing at all will be editable if you don\'t set this flag!',
164  'File uploads not allowed in PHP',
166  ));
167  } else {
168  $this->messageQueue->enqueue(new ‪FlashMessage(
169  '',
170  'File uploads allowed in PHP'
171  ));
172  }
173  }
174 
179  {
180  $maximumUploadFilesize = $this->‪getBytesFromSizeMeasurement(ini_get('upload_max_filesize'));
181  $maximumPostSize = $this->‪getBytesFromSizeMeasurement(ini_get('post_max_size'));
182  if ($maximumPostSize > 0 && $maximumPostSize < $maximumUploadFilesize) {
183  $this->messageQueue->enqueue(new ‪FlashMessage(
184  'upload_max_filesize=' . ini_get('upload_max_filesize') . LF
185  . 'post_max_size=' . ini_get('post_max_size') . LF
186  . 'You have defined a maximum size for file uploads in PHP which'
187  . ' exceeds the allowed size for POST requests. Therefore the'
188  . ' file uploads can also not be larger than ' . ini_get('post_max_size') . '.',
189  'Maximum size for POST requests is smaller than maximum upload filesize in PHP',
191  ));
192  } elseif ($maximumPostSize === $maximumUploadFilesize) {
193  $this->messageQueue->enqueue(new ‪FlashMessage(
194  'The maximum size for file uploads is set to ' . ini_get('upload_max_filesize'),
195  'Maximum post upload size correlates with maximum upload file size in PHP'
196  ));
197  } else {
198  $this->messageQueue->enqueue(new ‪FlashMessage(
199  'The maximum size for file uploads is set to ' . ini_get('upload_max_filesize'),
200  'Maximum post upload size is higher than maximum upload file size in PHP, which is fine.'
201  ));
202  }
203  }
204 
208  protected function ‪checkMemorySettings()
209  {
210  $minimumMemoryLimit = 64;
211  $recommendedMemoryLimit = 128;
212  $memoryLimit = $this->‪getBytesFromSizeMeasurement(ini_get('memory_limit'));
213  if ($memoryLimit <= 0) {
214  $this->messageQueue->enqueue(new ‪FlashMessage(
215  'PHP is configured not to limit memory usage at all. This is a risk'
216  . ' and should be avoided in production setup. In general it\'s best practice to limit this.'
217  . ' To be safe, set a limit in PHP, but with a minimum of ' . $recommendedMemoryLimit . 'MB:' . LF
218  . 'memory_limit=' . $recommendedMemoryLimit . 'M',
219  'Unlimited memory limit for PHP',
221  ));
222  } elseif ($memoryLimit < 1024 * 1024 * $minimumMemoryLimit) {
223  $this->messageQueue->enqueue(new ‪FlashMessage(
224  'memory_limit=' . ini_get('memory_limit') . LF
225  . 'Your system is configured to enforce a memory limit for PHP scripts lower than '
226  . $minimumMemoryLimit . 'MB. It is required to raise the limit.'
227  . ' We recommend a minimum PHP memory limit of ' . $recommendedMemoryLimit . 'MB:' . LF
228  . 'memory_limit=' . $recommendedMemoryLimit . 'M',
229  'PHP Memory limit below ' . $minimumMemoryLimit . 'MB',
231  ));
232  } elseif ($memoryLimit < 1024 * 1024 * $recommendedMemoryLimit) {
233  $this->messageQueue->enqueue(new ‪FlashMessage(
234  'memory_limit=' . ini_get('memory_limit') . LF
235  . 'Your system is configured to enforce a memory limit for PHP scripts lower than '
236  . $recommendedMemoryLimit . 'MB.'
237  . ' A slim TYPO3 instance without many extensions will probably work, but you should monitor your'
238  . ' system for "allowed memory size of X bytes exhausted" messages, especially if using the backend.'
239  . ' To be on the safe side,' . ' we recommend a minimum PHP memory limit of '
240  . $recommendedMemoryLimit . 'MB:' . LF
241  . 'memory_limit=' . $recommendedMemoryLimit . 'M',
242  'PHP Memory limit below ' . $recommendedMemoryLimit . 'MB',
244  ));
245  } else {
246  $this->messageQueue->enqueue(new ‪FlashMessage(
247  '',
248  'PHP Memory limit is equal to or more than ' . $recommendedMemoryLimit . 'MB'
249  ));
250  }
251  }
252 
256  protected function ‪checkPhpVersion()
257  {
258  $minimumPhpVersion = '7.2.0';
259  $currentPhpVersion = PHP_VERSION;
260  if (version_compare($currentPhpVersion, $minimumPhpVersion) < 0) {
261  $this->messageQueue->enqueue(new ‪FlashMessage(
262  'Your PHP version ' . $currentPhpVersion . ' is too old. TYPO3 CMS does not run'
263  . ' with this version. Update to at least PHP ' . $minimumPhpVersion,
264  'PHP version too low',
266  ));
267  } else {
268  $this->messageQueue->enqueue(new ‪FlashMessage(
269  '',
270  'PHP version is fine'
271  ));
272  }
273  }
274 
278  protected function ‪checkPcreVersion()
279  {
280  $minimumPcreVersion = '8.38';
281  if (!extension_loaded('pcre')) {
282  $this->messageQueue->enqueue(new ‪FlashMessage(
283  'TYPO3 CMS uses PHP extension pcre but it is not loaded'
284  . ' in your environment. Change your environment to provide this extension'
285  . ' in with minimum version ' . $minimumPcreVersion . '.',
286  'PHP extension pcre not loaded',
288  ));
289  } else {
290  $installedPcreVersionString = trim(PCRE_VERSION); // '8.39 2016-06-14'
291  $mainPcreVersionString = explode(' ', $installedPcreVersionString);
292  $mainPcreVersionString = $mainPcreVersionString[0]; // '8.39'
293  if (version_compare($mainPcreVersionString, $minimumPcreVersion) < 0) {
294  $this->messageQueue->enqueue(new ‪FlashMessage(
295  'Your PCRE version ' . PCRE_VERSION . ' is too old. TYPO3 CMS may trigger PHP segmentantion'
296  . ' faults with this version. Update to at least PCRE ' . $minimumPcreVersion,
297  'PCRE version too low',
299  ));
300  } else {
301  $this->messageQueue->enqueue(new ‪FlashMessage(
302  '',
303  'PHP extension PCRE is loaded and version is fine'
304  ));
305  }
306  }
307  }
308 
312  protected function ‪checkMaxExecutionTime()
313  {
314  $minimumMaximumExecutionTime = 30;
315  $recommendedMaximumExecutionTime = 240;
316  $currentMaximumExecutionTime = ini_get('max_execution_time');
317  if ($currentMaximumExecutionTime == 0) {
318  $this->messageQueue->enqueue(new ‪FlashMessage(
319  'max_execution_time=0' . LF
320  . 'While TYPO3 is fine with this, you risk a denial-of-service for your system if for whatever'
321  . ' reason some script hangs in an infinite loop. You are usually on the safe side '
322  . ' if it is reduced to ' . $recommendedMaximumExecutionTime . ' seconds:' . LF
323  . 'max_execution_time=' . $recommendedMaximumExecutionTime,
324  'Infinite PHP script execution time',
326  ));
327  } elseif ($currentMaximumExecutionTime < $minimumMaximumExecutionTime) {
328  $this->messageQueue->enqueue(new ‪FlashMessage(
329  'max_execution_time=' . $currentMaximumExecutionTime . LF
330  . 'Your max_execution_time is too low. Some expensive operations in TYPO3 can take longer than that.'
331  . ' It is recommended to raise the limit to ' . $recommendedMaximumExecutionTime . ' seconds:' . LF
332  . 'max_execution_time=' . $recommendedMaximumExecutionTime,
333  'Low PHP script execution time',
335  ));
336  } elseif ($currentMaximumExecutionTime < $recommendedMaximumExecutionTime) {
337  $this->messageQueue->enqueue(new ‪FlashMessage(
338  'max_execution_time=' . $currentMaximumExecutionTime . LF
339  . 'Your max_execution_time is low. While TYPO3 often runs without problems'
340  . ' with ' . $minimumMaximumExecutionTime . ' seconds,'
341  . ' it may still happen that script execution is stopped before finishing'
342  . ' calculations. You should monitor the system for messages in this area'
343  . ' and maybe raise the limit to ' . $recommendedMaximumExecutionTime . ' seconds:' . LF
344  . 'max_execution_time=' . $recommendedMaximumExecutionTime,
345  'Low PHP script execution time',
347  ));
348  } else {
349  $this->messageQueue->enqueue(new ‪FlashMessage(
350  '',
351  'Maximum PHP script execution time is equal to or more than ' . $recommendedMaximumExecutionTime
352  ));
353  }
354  }
355 
359  protected function ‪checkDisableFunctions()
360  {
361  $disabledFunctions = trim(ini_get('disable_functions'));
362 
363  // Filter "disable_functions"
364  $disabledFunctionsArray = $this->‪trimExplode(',', $disabledFunctions);
365 
366  // Array with strings to find
367  $findStrings = [
368  // Disabled by default on Ubuntu OS but this is okay since the Core does not use them
369  'pcntl_',
370  ];
371  foreach ($disabledFunctionsArray as $key => $disabledFunction) {
372  foreach ($findStrings as $findString) {
373  if (strpos($disabledFunction, $findString) !== false) {
374  unset($disabledFunctionsArray[$key]);
375  }
376  }
377  }
378 
379  if ($disabledFunctions !== '') {
380  if (!empty($disabledFunctionsArray)) {
381  $this->messageQueue->enqueue(new ‪FlashMessage(
382  'disable_functions=' . implode(' ', explode(',', $disabledFunctions)) . LF
383  . 'These function(s) are disabled. TYPO3 uses some of those, so there might be trouble.'
384  . ' TYPO3 is designed to use the default set of PHP functions plus some common extensions.'
385  . ' Possibly these functions are disabled'
386  . ' due to security considerations and most likely the list would include a function like'
387  . ' exec() which is used by TYPO3 at various places. Depending on which exact functions'
388  . ' are disabled, some parts of the system may just break without further notice.',
389  'Some PHP functions disabled',
391  ));
392  } else {
393  $this->messageQueue->enqueue(new ‪FlashMessage(
394  'disable_functions=' . implode(' ', explode(',', $disabledFunctions)) . LF
395  . 'These function(s) are disabled. TYPO3 uses currently none of those, so you are good to go.',
396  'Some PHP functions currently disabled but OK'
397  ));
398  }
399  } else {
400  $this->messageQueue->enqueue(new ‪FlashMessage(
401  '',
402  'No disabled PHP functions'
403  ));
404  }
405  }
406 
410  protected function ‪checkMysqliReconnectSetting()
411  {
412  $currentMysqliReconnectSetting = ini_get('mysqli.reconnect');
413  if ($currentMysqliReconnectSetting === '1') {
414  $this->messageQueue->enqueue(new ‪FlashMessage(
415  'mysqli.reconnect=1' . LF
416  . 'PHP is configured to automatically reconnect the database connection on disconnection.' . LF
417  . ' Warning: If (e.g. during a long-running task) the connection is dropped and automatically reconnected, '
418  . ' it may not be reinitialized properly (e.g. charset) and write mangled data to the database!',
419  'PHP mysqli.reconnect is enabled',
421  ));
422  } else {
423  $this->messageQueue->enqueue(new ‪FlashMessage(
424  '',
425  'PHP mysqli.reconnect is fine'
426  ));
427  }
428  }
429 
433  protected function ‪checkDocRoot()
434  {
435  $docRootSetting = trim(ini_get('doc_root'));
436  if ($docRootSetting !== '') {
437  $this->messageQueue->enqueue(new ‪FlashMessage(
438  'doc_root=' . $docRootSetting . LF
439  . 'PHP cannot execute scripts'
440  . ' outside this directory. This setting is seldom used and must correlate'
441  . ' with your actual document root. You might be in trouble if your'
442  . ' TYPO3 CMS core code is linked to some different location.'
443  . ' If that is a problem, the setting must be changed.',
444  'doc_root is set',
446  ));
447  } else {
448  $this->messageQueue->enqueue(new ‪FlashMessage(
449  '',
450  'PHP doc_root is not set'
451  ));
452  }
453  }
454 
458  protected function ‪checkOpenBaseDir()
459  {
460  $openBaseDirSetting = trim(ini_get('open_basedir'));
461  if ($openBaseDirSetting !== '') {
462  $this->messageQueue->enqueue(new ‪FlashMessage(
463  'open_basedir = ' . ini_get('open_basedir') . LF
464  . 'This restricts TYPO3 to open and include files only in this'
465  . ' path. Please make sure that this does not prevent TYPO3 from running,'
466  . ' if for example your TYPO3 CMS core is linked to a different directory'
467  . ' not included in this path.',
468  'PHP open_basedir is set',
470  ));
471  } else {
472  $this->messageQueue->enqueue(new ‪FlashMessage(
473  '',
474  'PHP open_basedir is off'
475  ));
476  }
477  }
478 
482  protected function ‪checkXdebugMaxNestingLevel()
483  {
484  if (extension_loaded('xdebug')) {
485  $recommendedMaxNestingLevel = 400;
486  $errorThreshold = 250;
487  $currentMaxNestingLevel = ini_get('xdebug.max_nesting_level');
488  if ($currentMaxNestingLevel < $errorThreshold) {
489  $this->messageQueue->enqueue(new ‪FlashMessage(
490  'xdebug.max_nesting_level=' . $currentMaxNestingLevel . LF
491  . 'This setting controls the maximum number of nested function calls to protect against'
492  . ' infinite recursion. The current value is too low for TYPO3 CMS and must'
493  . ' be either raised or xdebug has to be unloaded. A value of ' . $recommendedMaxNestingLevel
494  . ' is recommended. Warning: Expect fatal PHP errors in central parts of the CMS'
495  . ' if the value is not raised significantly to:' . LF
496  . 'xdebug.max_nesting_level=' . $recommendedMaxNestingLevel,
497  'PHP xdebug.max_nesting_level is critically low',
499  ));
500  } elseif ($currentMaxNestingLevel < $recommendedMaxNestingLevel) {
501  $this->messageQueue->enqueue(new ‪FlashMessage(
502  'xdebug.max_nesting_level=' . $currentMaxNestingLevel . LF
503  . 'This setting controls the maximum number of nested function calls to protect against'
504  . ' infinite recursion. The current value is high enough for the TYPO3 CMS core to work'
505  . ' fine, but still some extensions could raise fatal PHP errors if the setting is not'
506  . ' raised further. A value of ' . $recommendedMaxNestingLevel . ' is recommended.' . LF
507  . 'xdebug.max_nesting_level=' . $recommendedMaxNestingLevel,
508  'PHP xdebug.max_nesting_level is low',
510  ));
511  } else {
512  $this->messageQueue->enqueue(new ‪FlashMessage(
513  '',
514  'PHP xdebug.max_nesting_level ok'
515  ));
516  }
517  } else {
518  $this->messageQueue->enqueue(new ‪FlashMessage(
519  '',
520  'PHP xdebug extension not loaded'
521  ));
522  }
523  }
524 
528  protected function ‪checkMaxInputVars()
529  {
530  $recommendedMaxInputVars = 1500;
531  $minimumMaxInputVars = 1000;
532  $currentMaxInputVars = ini_get('max_input_vars');
533 
534  if ($currentMaxInputVars < $minimumMaxInputVars) {
535  $this->messageQueue->enqueue(new ‪FlashMessage(
536  'max_input_vars=' . $currentMaxInputVars . LF
537  . 'This setting can lead to lost information if submitting forms with lots of data in TYPO3 CMS'
538  . ' (as the install tool does). It is highly recommended to raise this'
539  . ' to at least ' . $recommendedMaxInputVars . ':' . LF
540  . 'max_input_vars=' . $recommendedMaxInputVars,
541  'PHP max_input_vars too low',
543  ));
544  } elseif ($currentMaxInputVars < $recommendedMaxInputVars) {
545  $this->messageQueue->enqueue(new ‪FlashMessage(
546  'max_input_vars=' . $currentMaxInputVars . LF
547  . 'This setting can lead to lost information if submitting forms with lots of data in TYPO3 CMS'
548  . ' (as the install tool does). It is highly recommended to raise this'
549  . ' to at least ' . $recommendedMaxInputVars . ':' . LF
550  . 'max_input_vars=' . $recommendedMaxInputVars,
551  'PHP max_input_vars very low',
553  ));
554  } else {
555  $this->messageQueue->enqueue(new ‪FlashMessage(
556  '',
557  'PHP max_input_vars ok'
558  ));
559  }
560  }
561 
565  protected function ‪checkReflectionDocComment()
566  {
567  $testReflection = new \ReflectionMethod(static::class, __FUNCTION__);
568  if ($testReflection->getDocComment() === false) {
569  $this->messageQueue->enqueue(new ‪FlashMessage(
570  'TYPO3 CMS core extensions like extbase and fluid heavily rely on method'
571  . ' comment parsing to fetch annotations and add magic belonging to them.'
572  . ' This does not work in the current environment and so we cannot install'
573  . ' TYPO3 CMS.' . LF
574  . ' Here are some possibilities: ' . LF
575  . '* In Zend OPcache you can disable saving/loading comments. If you are using'
576  . ' Zend OPcache (included since PHP 5.5) then check your php.ini settings for'
577  . ' opcache.save_comments and opcache.load_comments and enable them.' . LF
578  . '* In Zend Optimizer+ you can disable saving comments. If you are using'
579  . ' Zend Optimizer+ then check your php.ini settings for'
580  . ' zend_optimizerplus.save_comments and enable it.' . LF
581  . '* The PHP extension eaccelerator is known to break this if'
582  . ' it is compiled without --with-eaccelerator-doc-comment-inclusion flag.'
583  . ' This compile flag must be specified, otherwise TYPO3 CMS will not work.' . LF
584  . 'For more information take a look in our documentation ' . TYPO3_URL_WIKI_OPCODECACHE . '.',
585  'PHP Doc comment reflection broken',
587  ));
588  } else {
589  $this->messageQueue->enqueue(new ‪FlashMessage(
590  '',
591  'PHP Doc comment reflection works'
592  ));
593  }
594  }
595 
599  protected function ‪checkWindowsApacheThreadStackSize()
600  {
601  if ($this->‪isWindowsOs()
602  && strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === 0
603  ) {
604  $this->messageQueue->enqueue(new ‪FlashMessage(
605  'This current value cannot be checked by the system, so please ignore this warning if it'
606  . ' is already taken care of: Fluid uses complex regular expressions which require a lot'
607  . ' of stack space during the first processing.'
608  . ' On Windows the default stack size for Apache is a lot smaller than on UNIX.'
609  . ' You can increase the size to 8MB (default on UNIX) by adding the following configuration'
610  . ' to httpd.conf and restarting Apache afterwards:' . LF
611  . '<IfModule mpm_winnt_module>ThreadStackSize 8388608</IfModule>',
612  'Windows apache thread stack size',
614  ));
615  } else {
616  $this->messageQueue->enqueue(new ‪FlashMessage(
617  '',
618  'Apache ThreadStackSize is not an issue on UNIX systems'
619  ));
620  }
621  }
622 
630  protected function ‪checkPhpExtension(string $extension, bool $required = true, string $purpose = '')
631  {
632  if (!extension_loaded($extension)) {
633  $this->messageQueue->enqueue(new ‪FlashMessage(
634  'TYPO3 uses the PHP extension "' . $extension . '" but it is not loaded'
635  . ' in your environment. Change your environment to provide this extension. '
636  . $purpose,
637  'PHP extension "' . $extension . '" not loaded',
639  ));
640  } else {
641  $this->messageQueue->enqueue(new ‪FlashMessage(
642  '',
643  'PHP extension "' . $extension . '" loaded'
644  ));
645  }
646  }
647 
651  protected function ‪checkGdLibTrueColorSupport()
652  {
653  if (function_exists('imagecreatetruecolor')) {
654  $imageResource = @imagecreatetruecolor(50, 100);
655  if (is_resource($imageResource)) {
656  imagedestroy($imageResource);
657  $this->messageQueue->enqueue(new ‪FlashMessage(
658  '',
659  'PHP GD library true color works'
660  ));
661  } else {
662  $this->messageQueue->enqueue(new ‪FlashMessage(
663  'GD is loaded, but calling imagecreatetruecolor() fails.'
664  . ' This must be fixed, TYPO3 CMS won\'t work well otherwise.',
665  'PHP GD library true color support broken',
667  ));
668  }
669  } else {
670  $this->messageQueue->enqueue(new ‪FlashMessage(
671  'Gdlib is essential for TYPO3 CMS to work properly.',
672  'PHP GD library true color support missing',
674  ));
675  }
676  }
677 
681  protected function ‪checkGdLibGifSupport()
682  {
683  if (function_exists('imagecreatefromgif')
684  && function_exists('imagegif')
685  && (imagetypes() & IMG_GIF)
686  ) {
687  // Do not use data:// wrapper to be independent of allow_url_fopen
688  $imageResource = @imagecreatefromgif(__DIR__ . '/../../Resources/Public/Images/TestInput/Test.gif');
689  if (is_resource($imageResource)) {
690  imagedestroy($imageResource);
691  $this->messageQueue->enqueue(new ‪FlashMessage(
692  '',
693  'PHP GD library has gif support'
694  ));
695  } else {
696  $this->messageQueue->enqueue(new ‪FlashMessage(
697  'GD is loaded, but calling imagecreatefromgif() fails. This must be fixed, TYPO3 CMS won\'t work well otherwise.',
698  'PHP GD library gif support broken',
700  ));
701  }
702  } else {
703  $this->messageQueue->enqueue(new ‪FlashMessage(
704  'GD must be compiled with gif support. This is essential for TYPO3 CMS to work properly.',
705  'PHP GD library gif support missing',
707  ));
708  }
709  }
710 
714  protected function ‪checkGdLibJpgSupport()
715  {
716  if (function_exists('imagecreatefromjpeg')
717  && function_exists('imagejpeg')
718  && (imagetypes() & IMG_JPG)
719  ) {
720  $this->messageQueue->enqueue(new ‪FlashMessage(
721  '',
722  'PHP GD library has jpg support'
723  ));
724  } else {
725  $this->messageQueue->enqueue(new ‪FlashMessage(
726  'GD must be compiled with jpg support. This is essential for TYPO3 CMS to work properly.',
727  'PHP GD library jpg support missing',
729  ));
730  }
731  }
732 
736  protected function ‪checkGdLibPngSupport()
737  {
738  if (function_exists('imagecreatefrompng')
739  && function_exists('imagepng')
740  && (imagetypes() & IMG_PNG)
741  ) {
742  // Do not use data:// wrapper to be independent of allow_url_fopen
743  $imageResource = @imagecreatefrompng(__DIR__ . '/../../Resources/Public/Images/TestInput/Test.png');
744  if (is_resource($imageResource)) {
745  imagedestroy($imageResource);
746  $this->messageQueue->enqueue(new ‪FlashMessage(
747  '',
748  'PHP GD library has png support'
749  ));
750  } else {
751  $this->messageQueue->enqueue(new ‪FlashMessage(
752  'GD is compiled with png support, but calling imagecreatefrompng() fails.'
753  . ' Check your environment and fix it, png in GD lib is important'
754  . ' for TYPO3 CMS to work properly.',
755  'PHP GD library png support broken',
757  ));
758  }
759  } else {
760  $this->messageQueue->enqueue(new ‪FlashMessage(
761  'GD must be compiled with png support. This is essential for TYPO3 CMS to work properly',
762  'PHP GD library png support missing',
764  ));
765  }
766  }
767 
771  protected function ‪checkGdLibFreeTypeSupport()
772  {
773  if (function_exists('imagettftext')) {
774  $this->messageQueue->enqueue(new ‪FlashMessage(
775  'There is a difference between the font size setting which the GD'
776  . ' library should be supplied with. If installation is completed'
777  . ' a test in the install tool helps to find out the value you need.',
778  'PHP GD library has freetype font support'
779  ));
780  } else {
781  $this->messageQueue->enqueue(new ‪FlashMessage(
782  'Some core functionality and extension rely on the GD'
783  . ' to render fonts on images. This support is missing'
784  . ' in your environment. Install it.',
785  'PHP GD library freetype support missing',
787  ));
788  }
789  }
790 
801  protected function ‪isValidIp($ip)
802  {
803  return filter_var($ip, FILTER_VALIDATE_IP) !== false;
804  }
805 
811  protected function ‪isWindowsOs()
812  {
813  $windowsOs = false;
814  if (!stristr(PHP_OS, 'darwin') && stristr(PHP_OS, 'win')) {
815  $windowsOs = true;
816  }
817  return $windowsOs;
818  }
819 
828  protected function ‪trimExplode($delimiter, $string)
829  {
830  $explodedValues = explode($delimiter, $string);
831  $resultWithPossibleEmptyValues = array_map('trim', $explodedValues);
832  $result = [];
833  foreach ($resultWithPossibleEmptyValues as $value) {
834  if ($value !== '') {
835  $result[] = $value;
836  }
837  }
838  return $result;
839  }
840 
847  protected function ‪getBytesFromSizeMeasurement($measurement)
848  {
849  $bytes = (float)$measurement;
850  if (stripos($measurement, 'G')) {
851  $bytes *= 1024 * 1024 * 1024;
852  } elseif (stripos($measurement, 'M')) {
853  $bytes *= 1024 * 1024;
854  } elseif (stripos($measurement, 'K')) {
855  $bytes *= 1024;
856  }
857  return (int)$bytes;
858  }
859 }
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkXdebugMaxNestingLevel
‪checkXdebugMaxNestingLevel()
Definition: Check.php:479
‪TYPO3\CMS\Install\SystemEnvironment\Check\$suggestedPhpExtensions
‪string[] $suggestedPhpExtensions
Definition: Check.php:74
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkMaxExecutionTime
‪checkMaxExecutionTime()
Definition: Check.php:309
‪TYPO3\CMS\Install\SystemEnvironment\Check\$requiredPhpExtensions
‪array $requiredPhpExtensions
Definition: Check.php:58
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkDisableFunctions
‪checkDisableFunctions()
Definition: Check.php:356
‪TYPO3\CMS\Install\SystemEnvironment\CheckInterface
Definition: CheckInterface.php:31
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkGdLibTrueColorSupport
‪checkGdLibTrueColorSupport()
Definition: Check.php:648
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkMysqliReconnectSetting
‪checkMysqliReconnectSetting()
Definition: Check.php:407
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkMaxInputVars
‪checkMaxInputVars()
Definition: Check.php:525
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkReflectionDocComment
‪checkReflectionDocComment()
Definition: Check.php:562
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkCurrentDirectoryIsInIncludePath
‪checkCurrentDirectoryIsInIncludePath()
Definition: Check.php:125
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkFileUploadEnabled
‪checkFileUploadEnabled()
Definition: Check.php:151
‪TYPO3\CMS\Install\SystemEnvironment\Check\getStatus
‪FlashMessageQueue getStatus()
Definition: Check.php:85
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkPostUploadSizeIsHigherOrEqualMaximumFileUploadSize
‪checkPostUploadSizeIsHigherOrEqualMaximumFileUploadSize()
Definition: Check.php:175
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkGdLibGifSupport
‪checkGdLibGifSupport()
Definition: Check.php:678
‪TYPO3\CMS\Install\SystemEnvironment\Check\getBytesFromSizeMeasurement
‪int getBytesFromSizeMeasurement($measurement)
Definition: Check.php:844
‪TYPO3\CMS\Install\SystemEnvironment\Check\isWindowsOs
‪bool isWindowsOs()
Definition: Check.php:808
‪TYPO3\CMS\Core\Messaging\AbstractMessage\WARNING
‪const WARNING
Definition: AbstractMessage.php:28
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkWindowsApacheThreadStackSize
‪checkWindowsApacheThreadStackSize()
Definition: Check.php:596
‪TYPO3\CMS\Install\SystemEnvironment
Definition: Check.php:2
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkGdLibFreeTypeSupport
‪checkGdLibFreeTypeSupport()
Definition: Check.php:768
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkGdLibPngSupport
‪checkGdLibPngSupport()
Definition: Check.php:733
‪TYPO3\CMS\Install\SystemEnvironment\Check\$messageQueue
‪FlashMessageQueue $messageQueue
Definition: Check.php:54
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkPhpVersion
‪checkPhpVersion()
Definition: Check.php:253
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkGdLibJpgSupport
‪checkGdLibJpgSupport()
Definition: Check.php:711
‪TYPO3\CMS\Core\Messaging\FlashMessage
Definition: FlashMessage.php:22
‪TYPO3\CMS\Install\SystemEnvironment\Check
Definition: Check.php:51
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkPcreVersion
‪checkPcreVersion()
Definition: Check.php:275
‪TYPO3\CMS\Install\SystemEnvironment\Check\isValidIp
‪bool isValidIp($ip)
Definition: Check.php:798
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkOpenBaseDir
‪checkOpenBaseDir()
Definition: Check.php:455
‪TYPO3\CMS\Core\Messaging\AbstractMessage\NOTICE
‪const NOTICE
Definition: AbstractMessage.php:25
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkMemorySettings
‪checkMemorySettings()
Definition: Check.php:205
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkPhpExtension
‪checkPhpExtension(string $extension, bool $required=true, string $purpose='')
Definition: Check.php:627
‪TYPO3\CMS\Core\Messaging\FlashMessageQueue
Definition: FlashMessageQueue.php:25
‪TYPO3\CMS\Install\SystemEnvironment\Check\trimExplode
‪array trimExplode($delimiter, $string)
Definition: Check.php:825
‪TYPO3\CMS\Core\Messaging\AbstractMessage\ERROR
‪const ERROR
Definition: AbstractMessage.php:29
‪TYPO3\CMS\Install\SystemEnvironment\Check\checkDocRoot
‪checkDocRoot()
Definition: Check.php:430