• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved open_basedir / cron job working on one webserver but not on the other

Coltrane70

New Pleskian
Dear Community,
I'd appreciate some help with the following problem:

I've got two vhosts installed on my Plesk (Plesk Obsidian 18.0.35 Update #1). Both run a moodle instance with exactly the same PHP settings.

In order to run unoconv for moodle I installed it as root following this description: Init script example for unoconv on debian

I then adjusted the open_basedir setting in the PHP settings for both vhosts, so that the cron job can find the command, as follows:

vhost / website1: {WEBSPACEROOT}{/}{:}{TMP}{/}{:}/usr/bin/unoconv{:}/usr/bin/gs
vhost / website2: {WEBSPACEROOT}{/}{:}{TMP}{/}{:}/usr/bin/unoconv{:}/usr/bin/gs

With vhost / website 2 the cron job works fine. With website 1 I get the error message:

/usr/sbin/service: No such file or directory

My idea ist that the variable {webspaceroot} does not work for website1. The reason for this might be that I installed that website after website2.

In the php setting for website 1 I get the following information at the top:

You can use the following placeholders in parameter values:

{DOCROOT} for the document root directory of the website. The current value is /var/www/vhosts/website1.de/httpdocs. The HTTPS document root directory is the same as for http.
{WEBSPACEROOT} for the document root directory of the subscription's primary website.
{TMP} for the directory which stores temporary files.

In the php setting for website 2 I get the following information at the top:

You can use the following placeholders in parameter values:

{DOCROOT} for the document root directory of the website. The current value is /var/www/vhosts/website2.de/httpdocs. The HTTPS document root directory is the same as for http.
{WEBSPACEROOT} for the document root directory of the subscription's primary website.
{TMP} for the directory which stores temporary files.

So the only reason I can see why the cron job is working for website2 and not for website1 is that the webspaceroot variable isn't set correctly for website1.

Could you tell me how to check the value of that variable and how to change it?

Any help is appreciated!
 
hello @Coltrane70 ,

as I understand the difference between WEBSPACEROOT and DOCROOT is that the first one lead to docroot of the primary subscription domain
the second one should lead to the docroot of the additional domain inside the same subscription.

I'd suggest you to change open_basedir settings for the site1 to DOCROOT
 
Hello Nik G,
thanks for your reply!

I think I have the same understandig. But changing the settings to DOCROOT wouldn't help, as the script I need to execute is in /usr/bin.

I've just solved the problem myself. The system user for website1 didn't have access to the server over SSH. I've adjusted that setting in 'Web Hosting Access' 'System User' so that it now reads: "bin/sh".

That did the trick.
 
Hello at all,

I have the same problem only one vhost on my Plesk (Plesk Obsidian Web Admin Edition Version 18.0.51 Update #1), I followed the instructions and I solved the problem to find the unoconv file through the plugin. I can run unoconv via ssh with the site user, but when I try to load the test page, the program doesn't work.

Any help is very appreciated, thank you in advance
 
and I solved the problem to find the unoconv file through the plugin.
Could you please explain what that means and how it is related to this thread? "find ... file through the plugin": Which plugin, why does it need a plugin to find a file, how was it found?

I can run unoconv via ssh with the site user, but when I try to load the test page, the program doesn't work.
Which test page is that? How do you try to access it? What is expected to happen when you access it and what actually happens? Is an error displayed? Is an error logged in the error_log of the web server? Which error is logged? What do you mean by "program doesn't work"? What do you expect the program to do, what is it actual doing?
 
Hello Peter,
thank you for your answer. The thread is related to the utilize of unoconv for a moodle application on a plesk server. When the program unoconv is installed on debian server, you need activate it for moodle with 2 steps and this is done by web app caled moodle plugin. The first step (you can see in picture below) is
1680854346127.png
where the system ask for the position of the unoconv. In plesk is forbbiden access to the system folder and when I installed the unoconv, moodle didn't access to the path. With the setting in the php_setting now the web app is detecting unoconv and appared green V at the end of the textbox. I tried to launch the unoconv as web user thruogh a ssh connection to test it and it work. In the low part of the block there is a link for test unoconv "test unoconv path" and the result when it pressed is:

1680857212272.png
but if you continue wiht the test pressing Download the converted pdf test file, the system shows this:
1680857437021.png

with this error reported by moodle:
1680857499085.png
The file linked to the test is located in a moodle installation in:
/var/www/vhosts/website/httpdocs/moodle/files/converter/unoconv/testunoconv.php (these are the parameters: sendpdf=1&sesskey=ZCKLhqCR1D)

here there is test done by web user on ssh:

Code:
$ /usr/bin/unoconv
unoconv: you have to provide a filename or url as argument
Try `unoconv -h' for more information.
$ /opt/plesk/php/7.4/bin/php /var/www/vhosts/website/httpdocs/moodle/files/converter/unoconv/testunoconv.php
Command line scripts must define CLI_SCRIPT before requiring config.php
 
I did the opposit I removed the chroot, because for 8 months I tried to access a the unoconv file and it didn't work even if use update-chroot.sh for installing unoconv (as already done and as explained in the first post).
 
here there is test done by web user on ssh:

Code:
$ /usr/bin/unoconv
unoconv: you have to provide a filename or url as argument
Try `unoconv -h' for more information.
$ /opt/plesk/php/7.4/bin/php /var/www/vhosts/website/httpdocs/moodle/files/converter/unoconv/testunoconv.php
Command line scripts must define CLI_SCRIPT before requiring config.php
I'm not sure what the expected output would be. For the first example it says that an argument is missing, so what argument (probably a file) would that be and why is it missing? For the second example, that erro message comes from Moodle, not from the environment. So probably the testunoconv.php needs to be extended to satisfy the conditions that Moodle expects. I suggest try searching for "Command line scripts must define CLI_SCRIPT before requiring config.php" on Google, it will bring up several results. I don't see an issue with the server, it is merely a content issue of the script.
 
I'm not sure what the expected output would be. For the first example it says that an argument is missing, so what argument (probably a file) would that be and why is it missing? For the second example, that erro message comes from Moodle, not from the environment. So probably the testunoconv.php needs to be extended to satisfy the conditions that Moodle expects. I suggest try searching for "Command line scripts must define CLI_SCRIPT before requiring config.php" on Google, it will bring up several results. I don't see an issue with the server, it is merely a content issue of the script.
Hello Peter,
the tests are very quick, because I already tried the program and yes they are working fine. The first error is because I invoked unoconv without the input (a test file), the second error is because the script needs to be ran launch from a web page and there is no support for CLI. Anyway I attached the result of the test file performed by ssh
Code:
$ /usr/bin/unoconv /var/www/vhosts/website/httpdocs/moodle/moodledata/repository/local/testforunoconv.odt
$
as you can see without any erros
Code:
$ ls -la /var/www/vhosts/website/httpdocs/moodle/moodledata/repository/local/
total 5027680
drwxrwxrwx 3 webuser psacln       4096 Apr  7 12:49  .
drwxrwsrwx 3 webuser psacln         19 May  2  2022  ..
-rw-r--r-- 1 root  root           2270 Oct 11 01:30  testforunoconv.odt
-rw-r--r-- 1 webuser psacln      19432 Apr  7 12:49  testforunoconv.pdf

The problem is why I can run the program with the moodle user on ssh and I can't via web.
 
Back
Top