Install Moodle with open_basedir

Post Reply
absolutemusik
Posts: 11
Joined: Wed Feb 03, 2021 10:01 am
Install Moodle with open_basedir

Post by absolutemusik »

Hello all,
I have moved from vestacp (CentOS 7) to myvestacp. I am working on an education portal development with Moodle with the new MyVestCP environment.
For Moodle 3.10, it is required to have settings like

php_admin_value open_basedir /home/admin/web/example.com:/home/admin/web/example.com/public_html:/home/admin/web/example.com/moodledata:/home/admin/tmp

The above is being put in the example.com.conf and example.com.ssl.conf under /home/admin/conf/web/. Also, I have installed the libapache2-mod-php.
After the path settings, I have restarted the services of apache2 and php7.3-fpm.

It is still showing me the errors as: :shock:
Warning: file_exists(): open_basedir restriction in effect. File(home/admin/web/example.com/moodledata) is not within the allowed path(s):
(/home/admin/web/example.com/public_html:/home/admin/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp:/usr/share:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/roundcube:/var/log/roundcube:/var/lib/roubecube) in /home/admin/web/example.com/public_html.install.php on line 329

Warning: file_exists(): open_basedir restriction in effect. File(home/admin/web/example.com) is not within the allowed path(s):
(/home/admin/web/example.com/public_html:/home/admin/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp:/usr/share:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/roundcube:/var/log/roundcube:/var/lib/roubecube) in /home/admin/web/example.com/public_html.install.php on line 333

Also, I have checked all files named php.ini and found nothing being set as all being commented "#open_basedir=". :?:
./etc/php/7.3/fpm/php.ini
./etc/php/7.3/cli/php.ini
./etc/php/7.3/cgi/php.ini
./etc/php/7.3/apache2/php.ini
./usr/local/vesta/src/deb/for-download/php/php.ini
./usr/local/vesta/src/rpm/conf/php.ini
./usr/local/vesta/php/lib/php.ini

Actually, I have done similar steps in the vestcp with CentOS 7 before. :oops:
Should anyone has any clues, please kindly share.

Thanks
AM

absolutemusik
Posts: 11
Joined: Wed Feb 03, 2021 10:01 am
Re: Install Moodle with open_basedir

Post by absolutemusik »

I have also realized that it is using nginx at myvestacp. So, I have also update php.ini under /etc/php/7.x/fpm/
as suggested in
viewtopic.php?t=54

open_basedir=/home/admin/web/example.com:/home/admin/web/example.com/public_html:/home/admin/web/example.com/moodledata:/home/admin/tmp

User avatar
myVesta
Site Admin
Posts: 574
Joined: Fri Jun 19, 2020 9:59 am
Re: Install Moodle with open_basedir

Post by myVesta »

myVesta is using php-fpm instead of libapache2-mod-php.
I suggest:

Code: Select all

apt remove libapache2-mod-php
then change open_basedir in pool.d folder - viewtopic.php?f=18&t=54
and restart php-fpm

absolutemusik
Posts: 11
Joined: Wed Feb 03, 2021 10:01 am
Re: Install Moodle with open_basedir

Post by absolutemusik »

Thanks for your reply. The error is still existed as previous one. The /etc/php/7.3/fpm/php.ini is being edited and service restarted (systemctl restart php7.3-fpm).

#/etc/php/7.3/fpm/php.ini added with the line below:
open_basedir = /home/admin/web/example.com:/home/admin/web/example.com/moodle:/home/admin/tmp

In order to ensure a clear environment, it was a new VM w/o anything to do this trial attempt.

The moodledata subfolder was created by admin.
:?: :?: :?:
Warning: file_exists(): open_basedir restriction in effect. File(/home/admin/web/example.com/moodledata) is not within the allowed path(s): (/home/admin/web/example.com/public_html:/home/admin/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp:/usr/share:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/roundcube:/var/log/roundcube:/var/lib/roundcube) in /home/admin/web/example.com/public_html/install.php on line 329

Warning: is_writable(): open_basedir restriction in effect. File(/home/admin/web/example.com) is not within the allowed path(s): (/home/admin/web/example.com/public_html:/home/admin/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp:/usr/share:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/roundcube:/var/log/roundcube:/var/lib/roundcube) in /home/admin/web/example.com/public_html/install.php on line 333
Last edited by absolutemusik on Mon Feb 08, 2021 10:04 am, edited 1 time in total.

User avatar
myVesta
Site Admin
Posts: 574
Joined: Fri Jun 19, 2020 9:59 am
Re: Install Moodle with open_basedir

Post by myVesta »

no, you don't need to change php.ini
read carefully my post and tutorial.
open_basedir is in pool.d/ folder in domain.conf file.

absolutemusik
Posts: 11
Joined: Wed Feb 03, 2021 10:01 am
Re: Install Moodle with open_basedir

Post by absolutemusik »

Thanks so much. My mistake.
i have installed the moodle but facing some security concerns on phpMyAdmin.

I may do some research before asking a question at another session of the forum.


Post Reply