-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_simple.php
More file actions
35 lines (30 loc) · 956 Bytes
/
test_simple.php
File metadata and controls
35 lines (30 loc) · 956 Bytes
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
<?php
// test_simple.php - Simple test to see if PHP is working
header('Content-Type: text/plain');
header('Access-Control-Allow-Origin: *');
echo "PHP is working!\n";
echo "Current directory: " . getcwd() . "\n";
echo "PHP version: " . phpversion() . "\n";
// Test if we can write to the userfiles directory
$userfilesDir = '/tmp/userfiles';
echo "Testing userfiles directory: $userfilesDir\n";
if (!is_dir($userfilesDir)) {
echo "Directory does not exist, creating...\n";
if (mkdir($userfilesDir, 0755, true)) {
echo "Directory created successfully\n";
} else {
echo "Failed to create directory\n";
}
} else {
echo "Directory exists\n";
}
// Test write permissions
$testFile = $userfilesDir . '/test.txt';
echo "Testing write to: $testFile\n";
if (file_put_contents($testFile, 'test content') !== false) {
echo "Write successful\n";
unlink($testFile); // Clean up
} else {
echo "Write failed\n";
}
?>