-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.php
More file actions
123 lines (108 loc) · 3.92 KB
/
Copy pathsetup.php
File metadata and controls
123 lines (108 loc) · 3.92 KB
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
<?php
/**
* POS Backend Setup Script
* Run this script after cloning the repository to set up your environment
*/
echo "🚀 POS Backend Setup Script\n";
echo "============================\n\n";
// Check PHP version
echo "1. Checking PHP version...\n";
if (version_compare(PHP_VERSION, '7.4.0', '<')) {
echo " ❌ PHP 7.4 or higher is required. Current version: " . PHP_VERSION . "\n";
exit(1);
} else {
echo " ✅ PHP version: " . PHP_VERSION . "\n";
}
// Check required extensions
echo "\n2. Checking required PHP extensions...\n";
$required_extensions = ['mysqli', 'curl', 'gd', 'json', 'mbstring'];
$missing_extensions = [];
foreach ($required_extensions as $ext) {
if (extension_loaded($ext)) {
echo " ✅ $ext extension loaded\n";
} else {
echo " ❌ $ext extension not loaded\n";
$missing_extensions[] = $ext;
}
}
if (!empty($missing_extensions)) {
echo "\n Please install the following PHP extensions:\n";
foreach ($missing_extensions as $ext) {
echo " - $ext\n";
}
echo "\n On Ubuntu/Debian: sudo apt-get install php-$ext\n";
echo " On CentOS/RHEL: sudo yum install php-$ext\n";
echo " On Windows: Enable the extension in php.ini\n";
}
// Check if Composer is installed
echo "\n3. Checking Composer...\n";
if (file_exists('composer.phar') || file_exists('vendor/autoload.php')) {
echo " ✅ Composer dependencies found\n";
} else {
echo " ❌ Composer dependencies not found\n";
echo " Please run: composer install\n";
}
// Check configuration files
echo "\n4. Checking configuration files...\n";
if (file_exists('config/dbcon.php')) {
echo " ✅ Database configuration found\n";
} else {
echo " ❌ Database configuration not found\n";
echo " Please copy config/dbcon.example.php to config/dbcon.php\n";
echo " and update with your database credentials\n";
}
if (file_exists('stripe-php/config.php')) {
echo " ✅ Stripe configuration found\n";
} else {
echo " ❌ Stripe configuration not found\n";
echo " Please copy stripe-php/config.example.php to stripe-php/config.php\n";
echo " and update with your Stripe API keys\n";
}
// Check directory permissions
echo "\n5. Checking directory permissions...\n";
$writable_dirs = ['assets/uploads', 'chat-app/image'];
foreach ($writable_dirs as $dir) {
if (is_dir($dir)) {
if (is_writable($dir)) {
echo " ✅ $dir is writable\n";
} else {
echo " ❌ $dir is not writable\n";
echo " Please run: chmod 755 $dir\n";
}
} else {
echo " ⚠️ $dir directory does not exist\n";
}
}
// Create upload directories if they don't exist
echo "\n6. Creating required directories...\n";
foreach ($writable_dirs as $dir) {
if (!is_dir($dir)) {
if (mkdir($dir, 0755, true)) {
echo " ✅ Created directory: $dir\n";
} else {
echo " ❌ Failed to create directory: $dir\n";
}
}
}
echo "\n📋 Setup Summary:\n";
echo "================\n";
echo "1. Copy configuration files from examples\n";
echo "2. Update database credentials in config/dbcon.php\n";
echo "3. Update Stripe API keys in stripe-php/config.php\n";
echo "4. Run: composer install (if not already done)\n";
echo "5. Set up your database schema\n";
echo "6. Configure your web server\n\n";
echo "🔐 Security Reminders:\n";
echo "=====================\n";
echo "- Never commit API keys or database credentials\n";
echo "- Use environment variables in production\n";
echo "- Keep dependencies updated\n";
echo "- Enable HTTPS in production\n\n";
echo "📚 Next Steps:\n";
echo "==============\n";
echo "1. Read the README.md file for detailed instructions\n";
echo "2. Check the project documentation for implementation details\n";
echo "3. Test the system with sample data\n";
echo "4. Configure your production environment\n\n";
echo "🎉 Setup complete! Happy coding!\n";
?>