[BlueOnyx:26172] Re: BlueOnyx 5210R/5211R "open_basedir" can be set to "none" now

Fungal Style wayin at hotmail.com
Sat Apr 29 22:26:19 -05 2023


Thanks, will check it out a little later and let you know.

Get Outlook for Android<https://aka.ms/ghei36>
________________________________
From: Blueonyx <blueonyx-bounces at mail.blueonyx.it> on behalf of Michael Stauber <mstauber at blueonyx.it>
Sent: Sunday, April 30, 2023 11:36:11 AM
To: blueonyx at mail.blueonyx.it <blueonyx at mail.blueonyx.it>
Subject: [BlueOnyx:26171] Re: BlueOnyx 5210R/5211R "open_basedir" can be set to "none" now

Hi Brian,

> Ran into an issue I believe after the update.
> WHMCS says it wants to run the following, which has been working for a long time until within the last 24 hours (I think around 4-5 when I write this).
 >
> /usr/bin/php -q /home/.sites/site3/wwwroot/web/portal/crons/cron.php
>
> Via SSH root account, I get the following:
> [root@<servername> ~]# /usr/bin/php -q /home/.sites/site3/wwwroot/web/portal/crons/cron.php
> PHP Warning:  require_once(): open_basedir restriction in effect. File(/home/.sites/site3/wwwroot/web/portal/crons/bootstrap.php) is not within the allowed path(s): (/tmp/:/usr/sausalito/configs/php/:/var/lib/php/session/) in /home/.sites/site3/wwwroot/web/portal/crons/cron.php on line 0
> PHP Warning:  require_once(/home/.sites/site3/wwwroot/web/portal/crons/bootstrap.php): failed to open stream: Operation not permitted in /home/.sites/site3/wwwroot/web/portal/crons/cron.php on line 0
> PHP Fatal error:  require_once(): Failed opening required '/home/.sites/site3/wwwroot/web/portal/crons/bootstrap.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/.sites/site3/wwwroot/web/portal/crons/cron.php on line 0


There is no way for a cronjob to know which Vsite it belongs to. And
therefore it runs with the default php.ini for whatever PHP version (OS
or shop) you are using. And that php.ini does have restrictive
open_basedir settings.

But there is a way around that. Modify your cronjob to set a
'open_basedir=none' on the commandline:

/usr/bin/php -d open_basedir='none' my-script.php

... or ...

/home/solarspeed/php-<version>/bin/php -d open_basedir='none' my-script.php

So in your case it would be this:

/usr/bin/php -d open_basedir='none' -q
/home/.sites/site3/wwwroot/web/portal/crons/cron.php

That should do the trick.

Or if you want it to be restrictive, assemble a correct open_basedir for
your usage case like this:

/usr/bin/php -d
open_basedir='/tmp/:/usr/sausalito/configs/php/:/var/lib/php/session/:/home/.sites/site3/'
-q /home/.sites/site3/wwwroot/web/portal/crons/cron.php

That then limits this PHP cronjob to the above defined directories and
this one includes the root directory of the Vsite, which is missing if
you run with the 'open_basedir' settings of the php.ini alone.

--
With best regards

Michael Stauber
_______________________________________________
Blueonyx mailing list
Blueonyx at mail.blueonyx.it
http://mail.blueonyx.it/mailman/listinfo/blueonyx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.blueonyx.it/pipermail/blueonyx/attachments/20230430/74fdfee5/attachment.html>


More information about the Blueonyx mailing list