-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_php_cache.sh
More file actions
executable file
·67 lines (53 loc) · 2.02 KB
/
Copy pathcheck_php_cache.sh
File metadata and controls
executable file
·67 lines (53 loc) · 2.02 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
#!/bin/bash
# Script to check and clear PHP caching issues
# Run this directly on the Docker host (ubuntu@gighive)
echo "🔍 Checking PHP Cache Status"
echo "=============================="
echo ""
# 1. Check if OPcache is enabled
echo "1️⃣ Checking OPcache status..."
docker exec apacheWebServer php -i | grep -E 'opcache.enable|opcache.revalidate_freq'
echo ""
echo ""
# 2. Check current validator value in running PHP
echo "2️⃣ Testing current validator limit via PHP..."
docker exec apacheWebServer php -r "
require_once '/var/www/html/vendor/autoload.php';
\$validator = new \Production\Api\Validation\UploadValidator();
\$reflection = new ReflectionClass(\$validator);
\$property = \$reflection->getProperty('maxBytes');
\$property->setAccessible(true);
echo 'Current maxBytes: ' . number_format(\$property->getValue(\$validator)) . ' bytes' . PHP_EOL;
echo 'Expected: 6,442,450,944 bytes (6 GB)' . PHP_EOL;
"
echo ""
echo ""
# 3. Clear OPcache
echo "3️⃣ Clearing OPcache..."
docker exec apacheWebServer php -r "opcache_reset();" 2>/dev/null && echo "✅ OPcache cleared" || echo "⚠️ OPcache not available or already disabled"
echo ""
echo ""
# 4. Restart PHP-FPM
echo "4️⃣ Restarting PHP-FPM..."
docker exec apacheWebServer service php8.1-fpm restart
echo ""
echo ""
# 5. Verify file content again
echo "5️⃣ Verifying file content..."
docker exec apacheWebServer grep -n 'maxBytes.*6_' /var/www/html/src/Validation/UploadValidator.php
echo ""
echo ""
# 6. Test again
echo "6️⃣ Testing validator limit again after restart..."
docker exec apacheWebServer php -r "
require_once '/var/www/html/vendor/autoload.php';
\$validator = new \Production\Api\Validation\UploadValidator();
\$reflection = new ReflectionClass(\$validator);
\$property = \$reflection->getProperty('maxBytes');
\$property->setAccessible(true);
echo 'Current maxBytes: ' . number_format(\$property->getValue(\$validator)) . ' bytes' . PHP_EOL;
echo 'Expected: 6,442,450,944 bytes (6 GB)' . PHP_EOL;
"
echo ""
echo ""
echo "✅ Done! Try uploading again."