-
Notifications
You must be signed in to change notification settings - Fork 347
Expand file tree
/
Copy pathworker.php
More file actions
31 lines (24 loc) · 957 Bytes
/
worker.php
File metadata and controls
31 lines (24 loc) · 957 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
<?php
// Standalone PHP worker application for testing APP_START_CMD
// This simulates a background worker or queue processor
echo "Standalone PHP Worker Started\n";
echo "PHP Version: " . phpversion() . "\n";
echo "Working Directory: " . getcwd() . "\n";
echo "Script: " . __FILE__ . "\n";
// Create a marker file to verify the worker ran
$markerFile = getenv('HOME') . '/worker_ran.txt';
file_put_contents($markerFile, "WORKER_EXECUTED\n");
echo "Created marker file: $markerFile\n";
// Simulate worker loop (in real app this would process queue items)
$counter = 0;
$maxIterations = 5;
while ($counter < $maxIterations) {
$counter++;
echo "Worker iteration: $counter/$maxIterations\n";
// Write status to file for test verification
$statusFile = getenv('HOME') . '/worker_status.txt';
file_put_contents($statusFile, "ITERATION_$counter\n", FILE_APPEND);
sleep(1);
}
echo "Worker completed successfully\n";
exit(0);