Magento 1.9 store login not working in Chrome

On a site running Magento 1.9, user login is not working on Google Chrome.

The problem is due to cookie setting in Magento. Login to Magento Admin, go to

Admin > System > configuration > web > Session and Cookie Management

Put your domain name in “Cookie Domain” text box and click Save Config.

Magento

MySQL Permission denied

After changing MySQL data directory, i get error

Apr 17 03:01:20 hon-pc-01 mysqld[25298]: 180417 3:01:20 [Note] /usr/sbin/mysqld (mysqld 10.0.34-MariaDB-0ubuntu0.16.04.1) starting as process 25297 …
Apr 17 03:01:20 hon-pc-01 mysqld[25298]: 180417 3:01:20 [ERROR] mysqld: Can’t create/write to file ‘/mnt/backup/mysql/aria_log_control’ (Errcode: 13 “Permission denied”)
Apr 17 03:01:20 hon-pc-01 mysqld[25298]: 180417 3:01:20 [ERROR] mysqld: Got error ‘Can’t create file’ when trying to use aria control file ‘/mnt/backup/mysql/aria_log_control’

To fix error, you need following permissions.

Replace /var/lib/mysql with path to mysql data directory.

If this don’t resolve the problem, you need to check permission for parent folder.

What i did was to login as user “mysql” and see if i can change to MySQL data directory folder, if you have problem going to this folder, fix the permission that block you, mostly it is due to parent folder permission.

By default mysql user don’t have SSH access, to enable use vipw and change

To

Here /mnt/backup/mysql is where i store my MySQL data. Change it to whatever directory you store MySQL.

MySQL

Installing PhpStorm on Ubuntu

Download latest version of PhpStorm from

https://www.jetbrains.com/phpstorm/download/#section=linux

You get a file with name like “PhpStorm-2018.1.1.tar.gz”

Extract the file, put in a folder, i normally put it in directory ~/programs/phpstrom/

Now open terminal, go to folder

Run phpStrom with command

Create Application Shortcut

Creating application shortcut is easy. Just go to Tools > Create Desktop Entry.

phpstrom

Deploy Docker Image using Elastic Beanstalk

First create a file docker-eb-run.json with following content

here i used docker container bitnami/tomcat, you can use any container.

Login to AWS Console, go to AWS Elastic Beanstalk page. Click Get Started.

On next page, it ask for

For Application code, select Upload your code, click upload button and select “docker-eb-run.json” file you created.

Click “Create application” button. AWS will start deploying your docker container in Elastic Beanstalk, it will take a few minutes to complete.

Once deployment is completed, you get URL like

aws

Clean Magento session folder

On a VPS hosting Magento 1.9 disk was getting full. On checking, found var/session folder taking too much disk space.

Disk usage was 34 GB.

This folder is used to store PHP session files. You can delete them.

I created a cronjob to delete the session files that are older.

Add following content

Set a cronjob to run everyday

Method 2 – Strong session in database

Edit file

Find

Replace with

Magento

Getting Started with Amazon Elastic Beanstalk

AWS Elastic Beanstalk is a PaaS (Platform As Service) allow you to quickly deploy applications. To install AWS Elastic Beanstalk command line tool, run

Starting your first Project

Create a folder with a php file.

Add our project to git.

Initialise Elastic Beanstalk project

run

It will ask you to select a region

Select a region near to you. It will ask for Application name, you can use default name or enter your own. Since you have PHP file, it will auto detect you are using PHP and ask if you want to create PHP project.

It ask for if you need SSH access, answer yes, it will create an SSH key.

Creating your Environment

Now your project is ready, lets make it live in Amazon Elastic Beanstalk.

This ask you few questions like environment name, DNS name (this need to be unique).

You will be able to see the link for the application in the terminal, in this case, the URL is http://eb-project-1-dev.us-west-2.elasticbeanstalk.com, you can open the URL in browser to see the application. You can also use

This will open the application in your default web browser.

Updating Your Application

Make some changes to index.php and commit the changes. To deploy new version of your application to Amazon Elastic Beanstalk, run

SSH Access

To get SSH access to EC2 instance running your application, run

Terminate your application

Once you are done with you application, you can terminate it with command

aws

Install Monit on Ubuntu

Monit can be used to monitor services, restart them if required. To install monit, run

To start monit, run

Monitor Apache

Add

Activate the rule with

Restart monit with

Testing If Monit works

Open 2 terminals. On one, tail the monit logs with

On other terminal, stop Apache

Within 2 minutes, monit will restart apache web server.

monit

Unban an IP from CSF Firewall

To unban an IP from CSF firewall, run

Here i have an IP blocked in firewall.

To see if CSF is blocking the IP, run

Example

This command also give reason for why the IP is blocked.

Lets unban the IP address with command

Now IP should not be listed in iptables, verify it with

csf

Virtualmin Downloading PHP file

After setting up new site in virtualmin, PHP file get downloaded instead of getting executed.

To fix the problem, edit file

Find

Replace with

Restart apache

virtualmin