Ubuntu OpenLiteSpeed php81 occ

I am running OpenLiteSpeed on a Ubuntu server.

I have php 7.4, 8.0 & 8.1 installed. The path is /usr/local/lsws/lsphp81

My Nextcloud V26 runs on php8.1 and when I do phpinfo.php and check it says it’s 8.1

When I try this cmd:
sudo -u www-data /home/site.com/nextcloud/occ -V

It says:
This version of Nextcloud requires at least PHP 8.0 You are currently running 7.4.33. Please update your PHP version.

I tried running sudo -u www-data php8.1 and combinations thereof but then it complains about the cmd. I also cannot change the environment as I have two sites installed here, and the other site needs the php7.4 version.

Can someone clever please help, I am a total noob.

Your php8.1 does not point to litespeeds php cli binary.
To find out where it is pointing to you could execute which php8.1
To tackle this issue you could directly use the litespeed php binary like:

sudo -u www-data /usr/local/lsws/lsphp81/bin/php /home/site.com/nextcloud/occ -V

@alexoz Thank you so much! I tried this and it worked:
sudo -u www-data /usr/local/lsws/lsphp82/bin/php /home/site.com/nextcloud/occ -V

I get the following msg:
Cannot write into “config” directory!
This can usually be fixed by giving the web server write access to the config directory.

But, if you prefer to keep config.php file read only, set the option “config_is_read_only” to true in it.
See Configuration Parameters — Nextcloud latest Administration Manual latest documentation

I’ve added this to my config file but it stays the same:
‘config_is_read_only’ => true,

Any ideas how to solve this?

This sounds like a file permissions problem.
So set config_is_read_only to false. You have set it to true. This will (as the variable says) set it to read only and prevent writing to it.
After that set the correct file permissions as found in the nextcloud manual in list item 12.

@alexoz I tried doing this in the manual you gave:

chown -R www-data:www-data nextcloud
find nextcloud/ -type d -exec chmod 750 {} ;
find nextcloud/ -type f -exec chmod 640 {} ;

I was able to run the occ -V from the cmd line but it broke my internet access to nextcloud.

I now get this when I open the browser link: Screenshot by Lightshot

For info I am running Ubuntu with LiteSpeed & Cyberpanel

Please help!

Please check under which user your litespeed virtual host is running, it probably isn’t www-data.
After you have found out which user actually serves your nextcloud instance you can execute those commands again with the right user and group.

In this thread you can find a good starting point for a nextcloud setup with litespeed webserver. Please check that you have setup everything correctly.

1 Like

I’ll see if I can hire someone from upwork and then report back. I just don’t know enough and am a linux noob. I may just end up breaking the whole server.

Learning by doing :wink:

Appreciate all the help, someone from Upwork managed to get everything sorted.

sudo -u username/usr/local/lsws/lsphp81/bin/php /home/pathtoinstall/occ -V

1 Like

Thank you for sharing the solution!

@Irdi Thank you for all the help! Could not have done it without you. If anyone else ever gets stuck, why not ask Irdi? He did above and beyond and was super helpful!