Showing posts with label moodle. Show all posts
Showing posts with label moodle. Show all posts

Monday, March 19, 2018

Mysql migration: installation (version 5.5.31 is required and you are running 5.5.5.10.1.10)

Hello, you need to edit your config.php and specify database as "mariadb" instead of "mysqli"

Converting InnoDB tables to Barracuda in mysql/mariadb

$ cd /path/to/your/moodle
$ php admin/cli/mysql_compressed_rows.php
Script for detection of row size problems in MySQL InnoDB tables.

By default InnoDB storage table is using legacy Antelope file format
which has major restriction on database row size.
Use this script to detect and fix database tables with potential data
overflow problems.

Options:
-i, --info Show database information
-l, --list List problematic tables
-f, --fix Attempt to fix all tables (requires SUPER privilege)
-s, --showsql Print SQL statements for fixing of tables
-h, --help Print out this help

Example:
$ sudo -u www-data /usr/bin/php admin/cli/mysql_compressed_rows.php -l

$ php admin/cli/mysql_compressed_rows.php -l
mdl_data Compact (needs fixing)
mdl_data_fields Compact (needs fixing)
mdl_enrol_paypal Compact (needs fixing)
mdl_lti Compact (needs fixing)
mdl_user Compact (needs fixing)
mdl_user_info_field Compact (needs fixing)

$ php admin/cli/mysql_compressed_rows.php -f
Cannot enable GLOBAL innodb_file_per_table setting, use --showsql option and execute the statements manually.!!! Error writing to database !!!

$ php admin/cli/mysql_compressed_rows.php -s
Copy the following SQL statements and execute them using account with SUPER privilege:

USE moodle27;
SET SESSION sql_mode=STRICT_ALL_TABLES;
SET GLOBAL innodb_file_per_table=1;
SET GLOBAL innodb_file_format=Barracuda;
ALTER TABLE mdl_data ROW_FORMAT=Compressed;
ALTER TABLE mdl_data_fields ROW_FORMAT=Compressed;
ALTER TABLE mdl_enrol_paypal ROW_FORMAT=Compressed;
ALTER TABLE mdl_lti ROW_FORMAT=Compressed;
ALTER TABLE mdl_user ROW_FORMAT=Compressed;
ALTER TABLE mdl_user_info_field ROW_FORMAT=Compressed;

$ mysql -u root -p
Enter password: [invisible]
Welcome to the MySQL monitor.
[...]
mysql> use dbname;
Database changed
mysql> SET SESSION sql_mode=STRICT_ALL_TABLES;
Query OK, 0 rows affected (0.00 sec)


mysql> SET GLOBAL innodb_file_format=Barracuda;
Query OK, 0 rows affected (0.00 sec)


mysql> ALTER TABLE mdl_data ROW_FORMAT=Compressed;
Query OK, 0 rows affected, 2 warnings (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 2

MySQL full unicode support for Moodle

Steps to upgrade

Most important: Please backup your database before making any changes or running the CLI script.
  • Change configuration settings for MySQL (exactly the same for MariaDB). This step is optional. You can run the script and it will try and make these changes itself. If errors occur then try manually changing these settings as listed below.
    • On Linux based systems you will want to alter my.cnf. This may be located in '/etc/mysql/'.
    • Make the following alterations to my.cnf:
[client]
default-character-set = utf8mb4

[mysqld]
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix

character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
skip-character-set-client-handshake

[mysql]
default-character-set = utf8mb4
  • Restart your MySQL server.
  • Run the CLI script to convert to the new Character set and Collation (requires Moodle 3.1.5, 3.2.2 or newer):
$ php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci
NOTE: On very large sites this may take a long time to run. You should probably establish how long on a test install before taking your live site offline. In some cases you might consider dumping and re-importing your data.
  • Adjust the $CFG->dboptions Array in your config.php to make sure that Moodle uses the right Collation when connecting to the MySQL Server:
$CFG->dboptions = array(
  …
  'dbcollation' => 'utf8mb4_unicode_ci',
  …
);
If you only have access to the database command line (or something like phpmyadmin) you can try the following sql commands:
SET GLOBAL innodb_file_format = barracuda

SET GLOBAL innodb_file_per_table = 1

SET GLOBAL innodb_large_prefix = 'on' 
 
 
 
 
 

Saturday, March 19, 2016

Wednesday, July 22, 2015

Can't create a workable moodledata directory in centos 7 for moodle

First, put all your web content data under /var/www/html/. However, Fedora does not allow Apache to write anything anywhere by default, unless you explicitly permit that. For that, proper file/directory permissions are required, but not enough. Fedora uses SELinux (Security Enhanced Linux) to provide more robust security, and it doesn't allow Apache to write anything by default too.
Now, for each file and/or directory which should be writable (for which you receive ... is not writableerrors) you should set unconfined_u:object_r:httpd_sys_rw_content_t:s0 SELinux label to tell SELinux that these files/directories are allowed to be modified by Apache. For example, to make/var/www/moodledata and /var/www/html/moodle/theme writable, you should run (you can use -R so that this lable is set recursively if these directories contain subdirectories which should be writable):
chcon -R unconfined_u:object_r:httpd_sys_rw_content_t:s0 /var/www/moodledata /var/www/html/moodle/theme
Now, you can run setenforce 1 and see if the webiste is working properly. This is the solution.
But, what about setenforce 0 command? This command changes SELinux mode into permissivemode. In this mode, SELinux doesn't prevent any activity and only generates error messages in system's audit logs. This is why you didn't receive error messages anymore. However, putting SELinux in permissive mode is NOT a proper solution to make things work, I used it to see if your problem is related to SELinux. And, setenforce changes SELinux mode temporarily (until next shutdown/reboot). setenforce 1changes the SELinux mode to the default one, which is enforcing mode in which SELinux does actually prevent un-allowed activities.
This is the workflow that I would suggest when setting up a new thing in Fedora:
  1. Put SELinux into Permissive mode (setenforce 0)
  2. Set up the system as you like and make sure that it works correctly as intended
  3. Put SELinux back to Enforcing mode (setenforce 1)
  4. See if your system is still working fine. If not, check for SELinux errors in system audit logs (/var/log/audit) and try to solve the errors appropriately (it usually involves changing file/directory SELinux lables, or changing SELinux boolean parameters). A more user friendly approach is to useSELinux Troubleshooter GUI application rather than inspecting audit logs. It shows SELinux related errors along with suggested solutions.
Notice that you can modify SELinux configuration file (/etc/selinux/config) to completely disable SELinux or permanently set it into Permissive mode, but please don't. While many will suggest it as a solution to SELinux related problems, it is more like removing the problem rather than a solution for itu. However, for a development system where security is not important, you might decide to do that (In that case, I would personally prefer using permissive mode rather than completely disabling SELinux, so that you can still know about SELinux permission erros). When you decided to deploy your web application to production servers, you should know how to properly configure SELinux so that your web application works correctly even when SELinux is in Enfrocing mode.

Wednesday, April 28, 2010

Increasing File upload Size in Moodle on Ubantu

By default the upload size is 2Mb to increase the File Size limit in moodle (eg. increase limit to 50Megabytes) you will need to make the following changes:
In your php folder edit the php.ini file and change the following values:

post_max_size = 50M
upload_max_filesize = 50M

Note: On windows I had to restart IIS but I am not sure if you will need to restart apache on windows or linux.
Next go into Moodle  (in this case it is version 1.9.5) as admin and change the drop down menu’s for the following to your required size:

Courses -> Course Default Settings -> Maximum Upload Size
Modules -> Activities -> Assignment -> Maximum Size

---------------------------------------------------------------------------------------------------------------------

Modifying the php.ini file

These instructions show you how to change the file upload size by editing your php.ini file.

Ubuntu Linux Instructions

These instructions assume that you have installed the standard Moodle package, PHP 5 and Apache 2 via apt-get and left it all as a default install. If you have compiled yourself I presume that you will know where your php.ini files are!
You need to edit the following three settings in your php.ini file located at: /etc/php5/apache2/
  • Type "sudo nano /etc/php5/apache2/php.ini"
  • Press Ctrl and W and type "post_max_size"
  • Change the value to the number of Mb you want your site to accept as uploads
  • Press Ctrl and W and type "upload_max_filesize"
  • Change the value to the number of Mb you want your site to accept as uploads
  • Press Ctrl and W and type "max_execution_time"
  • Change the value to 600
  • Press Ctrl and O
  • Press Ctrl and X
  • Type sudo /etc/init.d/apache2 restart
Your new file size limit should now appear in Administration > Security > Site Policies > Maximum uploaded file size 
-------------------------------------------------------------------------------------------------------------------------------

Modifying the apache config file

Ubuntu Linux Instructions

You may also need to edit the config.php file in the moodle directory:
  • Type "gksudo nautilus" to get root permissions
  • Navigate to /etc/moodle
  • Open apache.conf
  • Go to the "" section
  • Change "php_value upload_max_filesize = 2M" to a higher value
  • Change "php_value post_max_size = 2M" to a higher value
  • Go to the "" section
  • Change "php_value upload_max_filesize = 2M" to a higher value
  • Change "php_value post_max_size = 2M" to a higher value
  • Save file
  • Type sudo /etc/init.d/apache2 restart