admin cli with lsphp !!! Error: Undefined constant "STDOUT" !!!

admin cli with lsphp !!! Error: Undefined constant "STDOUT" !!!

by Oliver Edelmann -
Number of replies: 9

Hi,

I tried to update from 5.0.1+ (Build: 20250718) (2025041401.06) nach 5.0.2+ (Build: 20250819).
Running "/usr/local/lsws/lsphp84/bin/lsphp admin/cli/maintenance.php --enable" and "/usr/local/lsws/lsphp84/bin/lsphp admin/cli/upgrade.php
shows "!!! Fehler: Undefined constant "STDOUT" !!!".

After search the internet I found the same problem with wordpress and LigthSpeed PHP.
I needed to add 
if(!defined('STDIN')) define('STDIN',  fopen('php://stdin',  'r'));
if(!defined('STDOUT')) define('STDOUT', fopen('php://stdout', 'w'));
if(!defined('STDERR')) define('STDERR', fopen('php://stderr', 'w'));

in admin/cli/maintenance.php and admin/cli/upgrade.php.

I'm not a developer and setting up Moodle Dev is over my skills. Would be create if a Developer could implement the fix.

Average of ratings: -
In reply to Oliver Edelmann

admin cli with lsphp !!! Error: Undefined constant "STDOUT" !!!

by Ken Task -
Picture of Particularly helpful Moodlers

So you must have a lightspeed web server as well.

https://docs.moodle.org/500/en/Installing_Moodle

Doesn't show lightspeed web service.  Am gonna venture a guess that you will probably run into other issues with litespeed server with a lsphp for a moodle.

That means you are on a 'bleeding edge' ... and can contribute the existing moodle docs for that combo.

Best resource might be:

https://www.php.net/manual/de/install.unix.litespeed.php

Good luck!

'SoS', Ken

In reply to Ken Task

admin cli with lsphp !!! Error: Undefined constant "STDOUT" !!!

by Ken Task -
Picture of Particularly helpful Moodlers

For your path ...

https://w3techs.com/technologies/overview/web_server

Something you might keep an eye on with your LS Server and LSPHP
https://moodledev.io/general/releases

5.0 brings some significant changes to Moodle.
Server requirements

These are just the minimum supported versions. We recommend keeping all of your software and operating systems up-to-date.

Moodle upgrade: Moodle 4.2.3 or later.
PHP version: minimum PHP 8.2.0 Note: minimum PHP version has increased in this Moodle version. PHP 8.3.x and 8.4.x are supported too. See PHP for details.
PHP extension sodium is required. See Environment - PHP extension sodium.
PHP setting max_input_vars must be >= 5000. For further details, see Environment - max input vars.

It is not an LTS version so you have to look forward to the next LTS release
which is 5.3 ... and it hasn't been released yet.
https://docs.moodle.org/500/en/Upgrading
Something new for everyone:
https://docs.moodle.org/500/en/Configuring_the_Router
And if you didn't install moodle code with git versioning, check out:
https://docs.moodle.org/500/en/Upgrading#Using_Git
Highly recommend (note: am not a dev either!)

'SoS', Ken

In reply to Ken Task

admin cli with lsphp !!! Error: Undefined constant "STDOUT" !!!

by Oliver Edelmann -
Hi Ken,

thanks for the response. The https://docs.moodle.org/500/en/Installing_Moodle lists OpenLigthSpeed in "Set up your server" section.
It is a link to https://docs.moodle.org/500/en/OpenLiteSpeed. It looks like somebody allready working on it.

Thanks for pointing to https://moodledev.io/general/releases. I think I will go for LTS for our productiv MOODLE installation.
In reply to Oliver Edelmann

admin cli with lsphp !!! Error: Undefined constant "STDOUT" !!!

by Emma Jeff -

Yes, OpenLiteSpeed is mentioned in the Moodle setup documentation, and it seems development is already in progress. Going with an LTS version for your production Moodle is a smart decision for stability.

In reply to Emma Jeff

admin cli with lsphp !!! Error: Undefined constant "STDOUT" !!!

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I would describe it as a brave decision. The first time I have seen a reference to OpenLiteSpeed is in this thread which means you are selecting an option where there is less background than the other options. It may be an excellent project (I like what I have found out in my total 3 minutes of research), but the other options come with many years of problem solving documentation and people who you can ask, whereas it looks to me like OpenLitSpeed does not.
In reply to Marcus Green

admin cli with lsphp !!! Error: Undefined constant "STDOUT" !!!

by Sergio Rabellino -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Reading the comparison on php serving performance, the OpenLiteSpeed site reports a 20% over nginx and even more versus apache, but the test it's not comparable to a Moodle classic "php execution": test were conducted only on little php scripts , and moodle code it's usually composed by big scripts.

So walking away from apache or nginx (I use both on different environment) and taking an adventure in the unknown is a risk without a real advantage (it's just a guess).

In reply to Sergio Rabellino

admin cli with lsphp !!! Error: Undefined constant "STDOUT" !!!

by James Steerpike -
Picture of Particularly helpful Moodlers
Litespeed is closed and proprietary software, unlike Apache and nginx, and needs a license. The license is free for OpenLiteSpeed but Open Source or not is always something I consider in choosing software.
In reply to James Steerpike

admin cli with lsphp !!! Error: Undefined constant "STDOUT" !!!

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I was just attempting to do some web application stuff and thought I might try lightspeed. Then I read the post above by James and decided against it.
In reply to Marcus Green

admin cli with lsphp !!! Error: Undefined constant "STDOUT" !!!

by James Steerpike -
Picture of Particularly helpful Moodlers

Actually OpenLiteSpeed is GPL3 so is opensource. My mistake.

Looks a little more complicated than Apache to set up.