Host Joomla 5.3.4 on a Windows Server (IIS) managed with Plesk.
Open Plesk → Scheduled Tasks.
Create a new task:
Task type: Run a PHP script
Script path:
iduminalanka.com\cli\joomla.php
Arguments:
session:gc --live-site="https://www.iduminalanka.com/"
PHP version: 8.4.7 (also tested with 8.2+)
Click Run Now.
The Joomla CLI command should execute successfully and perform the built-in session:gc cleanup without any errors.
The task fails immediately with the following error:
RuntimeException (#775)
#message: "Could not parse the requested URI http://%27httpsD:\InetPub\vhosts\cinsrilk-2473.package\iduminalanka.com\cli/"
#code: 0
#file: "D:\InetPub\vhosts\cinsrilk-2473.package\iduminalanka.com\libraries\vendor\joomla\uri\src\AbstractUri.php"
#line: 367
Joomla version: 5.3.4
PHP version: 8.4.7 (also tested with 8.2.x)
Database: MariaDB 9.6
Operating system: Windows Server (IIS)
Hosting control panel: Plesk
Site URL: https://www.iduminalanka.com/
The issue is reproducible using Joomla’s built-in CLI command session:gc, confirming it is not related to any third-party extension.
The error occurs during Joomla’s URI parsing stage when the --live-site parameter is included.
It appears to be a Windows-specific problem in the Joomla CLI application’s handling of local paths and URI formatting.
The CLI should be able to parse the --live-site argument correctly regardless of the operating system.
Attachments:
scheduletask.png — Plesk scheduled task configuration
error.png — CLI runtime error message
| Labels |
Added:
No Code Attached Yet
|
||
please help
hello, can someone answer please
I cannot check on windows.
On linux php cli/joomla.php session:gc works fine.
Your error trace seems incomplete and does not show full information.
session:gc does not require Uri to work, it could be that some of installed extensions doing something strange.
I cannot check on windows. On linux
php cli/joomla.php session:gcworks fine.Your error trace seems incomplete and does not show full information.
session:gcdoes not require Uri to work, it could be that some of installed extensions doing something strange.
Thank you for the reply, Fedik.
Just to clarify — the issue doesn’t seem related to any third-party extensions. The error occurs before any extensions or application code are loaded. The CLI fails inside Joomla’s own URI helper class on Windows.
From what I’ve observed (and confirmed with someone who investigated this deeper), the problem is specific to Windows. The Joomla CLI application appears to ignore both the --live-site argument and the $live_site value in configuration.php. Instead, it attempts to infer the site URL from the Windows environment variables. That logic seems to assume that on Windows, the process is always running under IIS, which is not true for CLI mode.
Because of this, URI::getInstance() ends up building an invalid URL like:
http://%27httpsD:\InetPub\vhosts...
So the failure isn’t related to the command (session:gc) itself or any installed extension — it’s due to how Joomla’s URI parsing behaves under Windows CLI. The same command runs fine on Linux, but the environment detection on Windows triggers this URI error.
please help
This is not about the operating systems windows or Linux. This is about the web server IIS compared to Apache.
Although officially IIS is supported there are very few users of this web server here.
to be honest I am surprised that anything works with Joomla works on IIS as I doubt anyone tests it. I did try earlier today to setup IIS for testing myself but gave up. If the project was honest it would remove any mention of IIS support
Not an IIS issue. This is Joomla CLI.
Problem: URI::getInstance must work on CLI, but inside it at lines 86‑103 we see:
if (!empty($_SERVER['PHP_SELF']) && !empty($_SERVER['REQUEST_URI'])) {On my Windows machine $_SERVER['PHP_SELF'] is empty. The code goes to the else branch:
$theURI = 'http' . $https . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];$_SERVER['HTTP_HOST'] comes from Joomla\CMS\Application\ConsoleApplication::populateHttpHost and it returns joomla.invalid.
But $_SERVER['SCRIPT_NAME'] is also empty on my Windows. Strange. I think the host of @IL-accountuser put the Joomla CLI directory in it:
D:\InetPub\vhosts\cinsrilk-2473.package\iduminalanka.com\cli
So when code builds $theURI it puts that whole folder into SCRIPT_NAME, making a bad URL.
Solution: In the file libraries/src/Application/ConsoleApplication.php after line 539, add this line:
$_SERVER['PHP_SELF'] = ($_SERVER['PHP_SELF'] ?? '') ?: (JPATH_ROOT . '/cli/joomla.php');Now $theURI becomes correct and CLI works fine.
(I translated with ChatGPT. It is better than my bad English.)
you should never ever need to use livesite