Set up PHP Development Environment with Docker

This article shows how you can set up a PHP development environment using Docker. We will be installing PHP, MySQL & Nginx, and PHPMyAdmin in the docker containers. Here’s a basic introduction to docker and docker tools & terminologies: Introduction to Docker and its Tools & Terminologies. Pre-requisites Docker should be installed on your machine: … Read more

Introduction to Docker and its Tools & Terminologies

Docker is an open-source software platform that enables developers to build, run, test, and deploy applications quickly. Your application or software is packaged into standardized units called containers. The container contains everything that’s needed to run the software including libraries, system tools, code, and other dependencies. Basically, docker helps to separate your application from your … Read more

Enable Xdebug in VSCode for PHP

Xdebug is a PHP extension that provides debugging and profiling capabilities. This article shows how you can enable and use Xdebug in the VSCode code editor. Install Xdebug Xdebug installation instruction is present here: https://xdebug.org/docs/install You can also follow these steps to get detailed instructions on installing Xdebug based on your system (Mac, Linux, Windows): … Read more

How to use Diff command to create Patch?

This article shows how you can create a diff patch file that can be used in Git repositories. The diff command line tool shows the difference between the two files. Such a difference between the two files is called a patch. The diff syntax is: diff [options] [original filename] [changed filename] diff [options] [original directory] … Read more

Backup & Restore Magento2 Database using N98-magerun2

n98-magerun is a handy CLI tool to work on Magento from command line. Backup/Dump Database Backup Database in a plain SQL File n98-magerun2.phar db:dump var/projectName_date.sql Print only the MySQL command. Do not execute it. This can be done by using the –only-command option. n98-magerun2.phar db:dump –only-command var/projectName_date.sql You may also use the time command which … Read more

Magento 2: Disable Admin Password Expiration/Change

Magento’s backend/admin password expires in 90 days by default. So, in every 90 days, when you login to admin, you will be asked to change your admin user’s password. This is a useful security feature in production/live site. However, this can be annoying to have in a development/testing site. This article shows on how you … Read more

Magento2: Reset Admin 2FA (Two-Factor Authentication)

This article shows how you can reset your Magento 2 Admin User’s 2FA (Two-Factor Authentication). Get your admin user ID from admin_user table. SELECT user_id from admin_user WHERE username = 'YOUR_ADMIN_USERNAME'; OR, SELECT user_id from admin_user WHERE email = 'YOUR_ADMIN_EMAIL'; For e.g. My admin user id = 299 username: MukeshChapagain Check two-factor authentication related table … Read more

Magento 2: ERR_TOO_MANY_REDIRECTS After Importing Database

Problem: Getting 302 redirects (ERR_TOO_MANY_REDIRECTS error) after I imported the server’s database into the local Magento setup. I am getting the redirect error on both backend and frontend. Investigation: I checked for the values for the web/ page in core_config_data table. MariaDB [magento]> SELECT * FROM core_config_data WHERE path LIKE "web/%"; +———–+———+———-+———————————————+——————————+———————+ | config_id | … Read more

Magento2: Programmatically Create Custom Layout XML

This article shows how you can create a custom layout XML handle programmatically in your custom module in Magento 2. I will be using event observer for this. app/code/Company/Module/etc/frontend/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="layout_load_before"> <observer name="mycompany_custom_layout" instance="Company\Module\Model\Observer\CustomLayout" /> </event> </config> app/code/Company/Module/Observer/CustomLayout.php Here, I am checking if a customer is logged in or not … Read more