Correct File Permissions for Magento 1.9x

These are the file permissions I set on a Magento 1.9 store after uploading the files, or when it starts throwing permission errors. Files and folders get ordinary permissions, and the folders Magento needs to write to (var, media and, during installation, app/etc) are made writable. This was written for Magento 1.9 in 2017. Magento 1 reached end of life in June 2020 and no longer gets official security patches, so if you still run it, plan a move to Magento 2 or to OpenMage, the community-maintained continuation of Magento 1. ...

September 26, 2017 · 3 min · Harshvardhan Malpani

How to view current deployment mode Magento2 and change it

Magento 2 runs in one of three modes, and the mode changes how it behaves: default is the mode a fresh install starts in. It works out of the box but isn’t optimized for a live store. developer shows errors in the browser and creates static files on demand, so code and theme changes show up without redeploying. It’s slower, and it shows error details to visitors, so never use it on a live store. production is for live stores. Errors are logged instead of displayed, and the static files and generated code are built in advance, which makes it the fastest mode. These are the commands to check the current mode and change it. Run them over SSH from the Magento root directory (the folder with bin/magento), as the user that owns the Magento files: ...

September 26, 2017 · 2 min · Harshvardhan Malpani

How to Update Magento 2.1x to latest version via SSH

If your Magento 2.1.x store was installed with Composer, you don’t need to download a fresh copy of Magento or click through the Web Setup Wizard to move to a newer 2.1 release. The whole upgrade can be done from an SSH session with the handful of commands below. These steps were written for Magento 2.1 and the example upgrades to 2.1.9. Replace 2.1.9 with the version you are moving to. ...

September 26, 2017 · 3 min · Harshvardhan Malpani

Updating Magento 1 via SSH

Magento 1 comes with its own command-line package manager, mage, which installs packages from Magento Connect. These are the commands I used to upgrade a Magento 1 store to the latest release over SSH, without downloading and uploading the files by hand. This was written in 2017 for Magento 1.9. Magento 1 reached end of life in June 2020, and there are no new official releases or security patches for it. The Magento Connect service these commands download from belonged to that era, so don’t count on it still answering. If you still run Magento 1, OpenMage, the community-maintained continuation of Magento 1, is the usual way to keep getting fixes. ...

September 26, 2017 · 2 min · Harshvardhan Malpani

Magento 2.1x Cron Jobs

Magento 2 relies on cron for its background work: reindexing when indexers are set to “Update by Schedule”, applying catalog price rules, sending newsletters, generating sitemaps, updating currency rates and more. If cron isn’t set up, none of that happens, and sooner or later the admin shows a message that indexers are invalid and asks you to make sure cron is running. These are the cron entries I add for a Magento 2.1 store, either through cPanel or with crontab -e. ...

August 12, 2017 · 3 min · Harshvardhan Malpani

How to unlike all Facebook pages from your profile and Clean your newsfeed

Hello humans, I have tried to keep this tutorial simple and detailed. Please proceed with caution. The following tutorial and the procedure will unlike pages you have liked from your profile, Please be clear about that the fact that the code provided here is clean and does not intend to do any harm to your Facebook account. Note – This code uses jQuery library in its original form. So you do not need to be scared while using this “scary” looking code. ...

May 18, 2017 · 3 min · Harshvardhan Malpani

Start a magento instance programmatically

When I need to run a one-off job on a Magento 1 store, such as fixing data in bulk or trying out a model, I don’t want to build a whole module for it. A standalone PHP file that loads Magento and then runs my code is enough. This is the bootstrap I put at the top of such a script. It’s for Magento 1, which has app/Mage.php; Magento 2 starts up differently, through app/bootstrap.php. ...

March 17, 2017 · 2 min · Harshvardhan Malpani

Inserting into SQL without specifying primary column

If the primary key is set to auto-increment, there are chances that you would not want to provide its value in the insert query. You don’t have to: MySQL can generate the next ID for you. Here is how to do it in MySQL: INSERT INTO table_name VALUES (NULL, 'column b', 'col c'); Assumption: the first column is the primary key, set to AI (AUTO_INCREMENT). When you insert NULL into an AUTO_INCREMENT column, MySQL replaces it with the next number in the sequence. Without a column list, VALUES has to contain a value for every column of the table, in the order the columns were defined, so the NULL is there as a placeholder for the ID. ...

March 14, 2017 · 2 min · Harshvardhan Malpani

Flushing Magento cache – The Programmer way

This is for Magento 1. Usually you clear the cache from System > Cache Management in the admin, but sometimes you need to do it from code: at the end of a deployment or import script, in a cron job, or after a script changes configuration directly in the database. This one line does it: Mage::app()->getCacheInstance()->flush(); What it does Mage::app() returns the running application, getCacheInstance() returns its cache object, and flush() empties the whole cache storage. It’s the same thing the Flush Cache Storage button in Cache Management does. ...

March 13, 2017 · 1 min · Harshvardhan Malpani

How to root Xiaomi Redmi 2 Prime without flashing custom recovery

In this article, I am going to explain rooting procedure of your MI REDMI 2 PRIME. Applies to redmi 2 also. Jump to Requirements -> Downloads -> Pre Root Checks -> Root Procedure Requirements: ADB and Fastboot TWRP Recovery Image SuperSU update package USB connection with android debugging and of course all drivers installed. Downloads from shared folder contain: adb and fastboot drivers as adb.zip twrp recovery image as twrp.zip SuperSU update package as UPDATE-SuperSU-v2.46.zip Final folder view looks like: ...

May 15, 2016 · 2 min · Harshvardhan Malpani