diff --git a/src/Framework/Prerequisites/Prerequisites.php b/src/Framework/Prerequisites/Prerequisites.php index 02833d5..0d63a55 100644 --- a/src/Framework/Prerequisites/Prerequisites.php +++ b/src/Framework/Prerequisites/Prerequisites.php @@ -170,6 +170,16 @@ class Prerequisites { } private function checkStoragePermissions() { + // Issue a warning if running as root in CLI context + if ($this->isCli && posix_getuid() === 0) { + $this->addCheck( + 'Root User Warning', + false, + 'Running as root - permission checks may be inaccurate. After setup, ensure storage/ is owned by your web server user', + 'warning' + ); + } + $storageDirs = array( 'storage', 'storage/db', @@ -516,6 +526,17 @@ class Prerequisites { } } + // Write out guidance for storage directory permissions + // if running the CLI script as root (since it will always appear to be writable) + if ($this->isCli && posix_getuid() === 0) { + $this->log("\nšŸ“‹ ROOT USER SETUP RECOMMENDATIONS:"); + $this->log("After uploading to your web server,"); + $this->log("make sure the storage directory is writable by the web server user by running:"); + $this->log(" chown -R www-data:www-data storage/ # Debian/Ubuntu"); + $this->log(" chown -R apache:apache storage/ # RHEL/CentOS/Fedora"); + $this->log(" chmod -R 770 storage/ # Ensure writability"); + } + $this->log("\nšŸ“ Full log saved to: " . $this->logFile); $this->log("=== Check completed at " . date('Y-m-d H:i:s') . " ==="); }