Monday, January 14, 2019

How to upload your source code to BitBucket?

Software Required
- git version 2.17.2 

Precondition
- BitBucket account has been registered
- Source code repository has been created on BitBucket  

Problems
- I'm a SVN user who heavily rely on it to manage my source code version control. I'm a rookie to use Git on both GitHub/BitBucket platform.
- During my Moodle and Dockers exploration, I decided to use BitBucket and git client to manage my source code.
- The reason I choose BitBucket is it support:- 
  • Unlimited private repository 
  • Git/Mercurial.
Steps
- Assume you have BitBucket account and repository created.
- Clone your empty repository from BitBucket into a source folder by executing the command below. Please fill in [username], [project name] and [repository] parameter based on the user account and repository name that you created at BitBucket.
$ git clone https://[username]@bitbucket.org/[project name]/[repository].git
- Copy your Moodle source code into the source folder
- Run the command below to add all the new files into the staging area.
$ git add .
- Run command below to commit the source code in the staging area into the BitBucket repository with the description
$ git commit -m "First commit"
- Run command below to check on the branch and master differences
$ git status

On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits)
- If message "Your branch is ahead of 'origin/master' by 1 commit" is observed, run the command below to push the origin to master
$ git push origin master
- Check on the BitBucket console, all the source code is uploaded/committed successfully.



How to turn on Moodle debug message on Dockers container?

Software Required
- docker-compose version 1.22.0
- macOS High Sierra
- docker version 18.06.1-ce
- Moodle version 3.6.1

Problems
- During the process of configuring Moodle on my Docker container, encountered the error message "Error reading from database" when launching my Moodle portal. I can't launch the Moodle main login page.
- I can't proceed from there and have no clue on what is going on that blocked the system from launching.
- I need more details through the Moodle debug message

Steps
- Came across Moodle support side, it provided steps to turn on the Moodle debug message. However, it does not provide the configuration details on Dockers.
- I'm using docker-compose, hence, I added configuration below to my docker-compose.yml file
volumes: - ./phpconf/custom.php.ini:/usr/local/etc/php/conf.d/custom.php.ini
- I created "phpconf" folder in my docker-compose parent folder and place "custom.php.ini" file in the folder.
- Below are the content of the "custom.php.ini" file. 
display_startup_errors=On
log_errors=On
- Added configuration below in the Moodle config.php
ini_set ('display_errors', 'on');
ini_set ('log_errors', 'on');
ini_set ('display_startup_errors', 'on');
ini_set ('error_reporting', E_ALL);
$CFG->debug = 30719; // DEBUG_ALL, but that constant is not defined here

//The configuration must above this line
require_once(__DIR__ . '/lib/setup.php');
- Restart the docker-compose by running the command below
#docker-compose down
#docker-compose kill
#docker-compose up
- Refresh the Moodle page, error message "Table "sessions" does not exist" is displayed. Obviously, the DB dump that I used to restore the database in Dockers MySQL database is not complete. 
- In order to check the configuration has been taken effect in the php.ini file, add phpinfo() into config.php. Reload the page, you will be able to confirm the implementation has been taken effect.




Wednesday, January 2, 2019

How to resolve Intl extension enabling issue when install Moodle on XAMPP?

Software Required

- macOS High Sierra
- XAMPP 7.0.33 / PHP 7.0.33. Please refer to download
- Moodle version 3.6.1. Please refer to download

Problem
  • During the Moodle installation on XAMPP, Intl extension checking message is displayed. Please refer to the screenshot below

Steps
  • To check the location of php.ini, browse to http://localhost/dashboard/phpinfo.php
  • Obviously, php.ini is located at "/Applications/XAMPP/xamppfiles/etc/" directory
  • Run command below to check the php path
which php
  • Run command below to change the PHP path to XAMPP PHP folder if default path is "/usr/bin/php"
PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"
  • Run command below to generate Intl extension
brew tap kyslik/homebrew-php
brew install kyslik/php/php70-intl
    • Alter php.ini by inserting the configuration as shown below
    extension="/usr/local/Cellar/php70-intl/7.0.27_25/intl.so"
        • Press "Reload" button, the Intl extension error will be resolved. 

        Tuesday, January 1, 2019

        How to resolve mysql_full_unicode_support error when deploy Moodle on XAMPP?

        Software Required

        - macOS High Sierra
        - XAMPP-VM/PHP 7.3.0. Please refer to download
        - Moodle version 3.6.1

        Problem

        • During the Moodle installation on XAMPP, mysql_full_unicode_support error message is prompted. Please refer to the screenshot below
        • "Barracuda file format" and "full support of UTF-8 on MySql" errors need to be fixed.
        Steps
        • Locate my.cnf that located at "/opt/lampp/etc/" directory. Insert the configuration as shown below
        [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 MySql server. Done!


              Sunday, December 30, 2018

              How to resolve OPCache configuration issue when install Moodle?

              Software Required

              - macOS High Sierra
              - XAMPP-VM/PHP 7.3.0. Please refer to download
              - Moodle version 3.6.1. Please refer to download

              Problem
              • During the Moodle installation on XAMPP, OPCache plugin checking message is displayed. Please refer to the screenshot below

              Steps
              • To check the location of php.ini, browse to http://localhost:8080/dashboard/phpinfo.php
              • Obviously, php.ini is located at "/opt/lampp/etc/" directory
              • Uncomment ";" at the line 1031 to enable opcache library
              zend_extension=opcache.so
                • Append the opcache configuration as shown below
                [opcache]
                opcache.enable = 1
                opcache.memory_consumption = 128
                opcache.max_accelerated_files = 10000
                opcache.revalidate_freq = 60
                
                ; Required for Moodle
                opcache.use_cwd = 1
                opcache.validate_timestamps = 1
                opcache.save_comments = 1
                opcache.enable_file_override = 0
                
                ; If something does not work in Moodle
                ;opcache.revalidate_path = 1 ; May fix problems with include paths
                ;opcache.mmap_base = 0x20000000 ; (Windows only) fix OPcache crashes with event id 487
                
                ; Experimental for Moodle 2.6 and later
                ;opcache.fast_shutdown = 1
                ;opcache.enable_cli = 1 ; Speeds up CLI cron
                ;opcache.load_comments = 0 ; May lower memory use, might not be compatible with add-ons and other apps.
                    • Restart the XAMPP VM, the OPCache plugin checking message is not prompted anymore.

                    How to resolve vim editor not found on XAMPP VM?


                    Software Required

                    - macOS High Sierra
                    - XAMPP-VM/PHP 7.3.0. Please refer to download
                    - Moodle version 3.6.1. Please refer to download

                    Problem
                    • During the Moodle installation on XAMPP, vim editor is not available
                    • Try to install vim editor by executing the command below
                    apt-get install vim
                    • Error message as shown below is displayed
                    Reading package lists... Done
                    Building dependency tree       
                    Reading state information... Done
                    E: Unable to locate package vim

                    Steps
                    • Obviously, package index files are not up to date.
                    • Run the command below, it will work like a charm. vim editor command is installed and it is ready for used.

                    apt-get update
                    apt-get install apt-file
                    apt-file update
                    apt-get install vim
                    


                        Tuesday, December 25, 2018

                        How to resolve "No Entry" sign at Mac startup page?

                        Software Required

                        - macOS High Sierra


                        Problem

                        • Update my Mac OS (High Sierra) recently, no symptom after the OS update
                        • Restart my Macbook recently, encounter Macbook unable to boot up issue
                        • "No Entry" sign always show after the Apple logo
                        • The system will reboot and it will keep repeating couple of times and remain shut down afterwards
                        Steps
                        • Make sure your Mac machine is shutting down. 
                        • Press "Command" + "R" key
                        • Press the "Power" button to start the Mac machine
                        • "Mac OS X Utilities" window will be displayed
                        • Select "Reinstall Mac OS X" option, click on "Continue" button
                        • Follow the steps in the wizard, you will get the your Mac machine start up to work like a charm.
                        Note: Reinstall Mac OS X will not cause data lost.