Problem installing Moodle 3.11 on Hestia 1.4.5

This is very strange. About four weeks ago, I installed Hestia CP onto a Debian 10 VPS. I then created a new user and installed Moodle 3.11 on my Hestia user control panel. Moodle installed with only minor problems. Two days ago, I created another Debian 10 VPS and installed Hestia onto it. I then created a new user and installed the same Moodle 3.11 on the new Hestia user account with a different domain name. The version of the new Hestia Control Panel is 1.4.5. The version of the Hestia Control Panel I set up in June was either 1.4.3 or 1.4.4. The older control panel has since updated itself to version 1.4.5. I set up identical databases for both and placed the moodle data folder in the domain root private folder on both.

Here is where it gets very crazy. While Moodle 3.11 installed fine on the prior version of Hestia, and runs well on the new version of Hestia, Moodle 3.11 does not install on the new version of Hestia. Here is the error that appears at the top of the Moodle installation page:

Warning: is_readable(): open_basedir restriction in effect. File(/db/renamedclasses.php) is not within the allowed path(s): (/home/bfn2/web/betterfutureenglish.com/public_html:/home/bfn2/web/betterfutureenglish.com/private:/home/bfn2/web/betterfutureenglish.com/public_shtml:/home/bfn2/tmp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt) in /home/bfn2/web/betterfutureenglish.com/public_html/lib/classes/component.php on line 1210

The warning is misleading because it claims that the file can not be read because it is not in the correct path. But as you can see from above, public_html is in the correct path. So there is nothing wrong with my Hestia template which is the PHP-FPM default template. Still for some reason, db/namedclasses.php (the file called on component.php is not readable.

I know I can just turn off open_basedir. But I did not have to do this when I installed Moodle 3.11 just a few weeks ago. So I am wondering if some change in Hestia occurred in the past four weeks which might be causing this problem.

I also understand that this may be a Moodle problem and not a Hestia problem. But if that were the case, then why did Moodle 3.11 install a few weeks ago without this warning - and yet now, it has this warning?

I have also tried to install several different recent versions of Moodle and they all produce the same error. I have been trying to figure this out for the past two days. But I am stumped. Any ideas or suggestions would be greatly appreciated.

Regards,

David Spring

In /usr/local/hestia/data/templates/web/php-fpm/ there Is a file called:

PHP-x_x.tpl create a copy (moodle-PHP-x_x.tpl and change:

And you are done…

Eris,

Thank you for your suggestion. I have actually spent the past two days attempting to change Line 20 of the backend default php-fpm template. Here is a summary of my latest efforts based in part on your suggestion.

I copied

PHP-7_4.tpl

and renamed it

moodle-PHP-7_4.tpl

I then compared it to the file in the link you provided. My file was missing

/temp:

So I added this to line 20 to make it a permitted path.

I then changed all of the paths in line 20 to the absolute paths.

I then changed the default backend template for the website to

moodle-PHP-7_4.tpl

I then restarted php-fpm and even restarted the entire VPS server from the Hestia admin panel settings.

I then cleared the browser cache and typed in the URL again for about the 100th time. Sadly, the warning still persisted only this time with the absolute paths rather than the variable paths:

Warning: is_readable(): open_basedir restriction in effect. File(/db/renamedclasses.php) is not within the allowed path(s): (/home/bfn2/web/betterfutureenglish.com/public_html:/home/bfn2/web/betterfutureenglish.com/private:/home/bfn2/web/betterfutureenglish.com/public_shtml:/home/bfn2/tmp:/temp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt) in /home/bfn2/web/betterfutureenglish.com/public_html/lib/classes/component.php on line 1210

Then based on a suggestion for a similar problem, I went to the php.ini file for the server:

/etc/php/7.4/fpm/php.ini

I then scrolled down to line 307 and delete the semi-colon to activate open_basedir = . I then add the absolute paths here also. Then I used Hestia to restart php-fpm and restart the VPS server. Sadly, this also had no effect on the warning.

I agree that your suggestion should work. But sadly, it did not work. This is why this warning is so mysterious to me. This warning should not be occurring. So once again, I am at a loss for how this could be happening. Any additional suggestions would be greatly appreciated.

Regards,

David Spring

I finished day 3 of my Moodle adventure. I completely rebuilt my VPS but not even that helped. I now understand that Moodle does not like open_basedir restrictions. They recommend simply turning it off. I understand this is a bad idea. But unfortunately, several areas of the Moodle code are badly written which is why they insist that folks not use open_basedir.

However, the offending files (which have no real path and often do not even exist) are only loaded and checked during installation. So my new plan is to temporarily turn off open_basedir restrictions during the installation and then turn it back on again after the moodle installer is finished looking for code that does not exist.

I am using the PHP-FPM default back end template and the Hestia version is 1.4.5. I have tried several methods to turn off open_basedir restrictions. For example, I have tried hashing out Line 20, deleting line 20 and replacing Line 20 with

php_admin_value[open_basedir] = “none”

also

php_admin_value[open_basedir] = none

None of these methods has actually turned off open_basedir restrictions. Any suggestions for temporarily turning off open_base restrictions in the Hestia php-fpm backend default template would be greatly appreciated.

php_admin_value[open_basedir] = “/” should probally work fine

Eris,
Thank you for your suggestion. You advice is always very sound. But I am sorry to report that changing to “/” made no difference. I changed the template line 20 and restarted php-fpm. I even restarted the server. Still the same error so open basedir restriction is still in effect. It is very important to me to solve this problem. I am really running out of ideas and I am wondering if I can pay you or any other Hestia knowledgeable person for an hour of your time to help me solve this problem? If so, who should I contact and how can I contact them? This is truly a crazy problem.

You need to rebuild the config first

I had the same problem with existing installations for webapps based on YII2 and/or Laravel. New installations work fine. To solve the issue for existing installations, I’ve followed the logs like your ( **Warning** : is_readable(): open_basedir restriction in effect. File(/db/renamedclasses.php) is not within the allowed path(s): ) where the warning says clearly the restricted path is on base root / .

So i create a copy of my custom templates and i just edit the open_base_dir like Eris suggest : /: and by keeping all the others path like are by deafault. The final result for open_base:dir could be in your case :

/:/home/bfn2/web/betterfutureenglish.com/public_shtml:/home/bfn2/tmp:/temp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt

Hope this helps

Eris and Ubi,
Thank you, thank you, thank you! Adding /: to the beginning of the default template and then keeping the rest of the paths at their default values solved the problem! After 4 days of trying, I can finally get some sleep. Thanks again. My only hope is that some day I can return the favor.
Regards,
David Spring

I am about to deploy a Moodle. Maybe this will come handy!

For those who do not know, I have been a college level web design instructor for more than 20 years. I am mainly a teacher rather than a developer. My hope is to eventually write a series of tutorials promoting Hestia CP to non-technical users. With thanks to Eris and Ubi, I have created a detailed tutorial on how to install Moodle 3.11 on Hestia 1.4.5. I am also posting this as a separate forum post for teachers interested in using Hestia to create a Moodle website. Here is a link to the Hestia Moodle Tutorial.

https://createyourownonlinecourse.org/1-freedom-to-teach/1-3-how-to-install-moodle-on-a-hestia-vps

Feel free to post any questions you may have about using Hestia to install and run a Moodle website. I will try to answer them.
Regards,
David Spring

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.