-
Notifications
You must be signed in to change notification settings - Fork 0
/
requirements.php
78 lines (62 loc) · 2.35 KB
/
requirements.php
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
<?php
$requirements = [];
if (PHP_VERSION_ID < 80200) {
$requirements[] = 'Please upgrade to PHP Version 8.2 or later!';
}
// Function to check if an extension is enabled in php.ini
function is_extension_enabled($extension)
{
return extension_loaded($extension);
}
// Function to check if a function is enabled in php.ini
function is_function_enabled($function)
{
return function_exists($function);
}
// Check if MBString extension is enabled
if (!is_extension_enabled('mbstring')) {
$requirements[] = 'MBString extension is enabled on your PHP configuration.';
}
// Check if JSON extension is enabled
if (!is_extension_enabled('json')) {
$requirements[] = 'JSON extension is enabled on your PHP configuration.';
}
// Check if cURL extension is enabled
if (!is_extension_enabled('curl')) {
$requirements[] = 'cURL extension is enabled on your PHP configuration.';
}
// Check if exec() function is enabled
if (!is_function_enabled('exec')) {
$requirements[] = 'You need to enable exec() function in your PHP configuration.';
}
// Check if unlink() function is enabled
if (!is_function_enabled('unlink')) {
$requirements[] = 'You need to enable unlink() function in your PHP configuration.';
}
// Check if getenv() function is enabled
if (!is_function_enabled('getenv')) {
$requirements[] = 'You need to enable getenv() function in your PHP configuration.';
}
// Check if putenv() function is enabled
if (!is_function_enabled('putenv')) {
$requirements[] = 'You need to enable putenv() function in your PHP configuration.';
}
// Check if require_once() function is enabled
if (is_function_enabled('require_once')) {
$requirements[] = 'You need to enable require_once() function in your PHP configuration.';
}
// Check if mkdir() function is enabled
if (!is_function_enabled('mkdir')) {
$requirements[] = 'You need to enable mkdir() function in your PHP configuration.';
}
// Check directory writability
$fullPath = Yii::getAlias('@app') . '/vendor';
if (!is_writable($fullPath)) {
$requirements[] = "The directory '$fullPath' is not writable by the PHP process.";
}
// Check if composer.json exists in the specified directory
$composerJsonPath = Yii::getAlias('@webroot') . '/composer.json';
if (!file_exists($composerJsonPath)) {
$requirements[] = "composer.json file doesn't exist in the specified directory.";
}
return $requirements;