Saturday, September 26, 2020

fwrite() expects parameter 1 to be resource, bool given in

Sometimes in Opencart you may get these kind of warnings in browser.

fwrite() expects parameter 1 to be resource, bool given in /var/www/html

Solution to fix:
Check your selinux status, if selinux is enabled, you need to disable selinux and reboot the machine.

Saturday, September 5, 2020

How to restrict wp-admin access from one IP

 How to restrict wp-admin access from one IP

As you know, wordpress is a easy to hack content management system. If you want to restric the admin area of your wordress (wp-admin), you can easily do this by adding the below line in .htaccess

Go to the folder where your blog hosts

vi .htaccess

<IfModule mod_rewrite.c>

<Files wp-login.php>

order deny,allow

deny from all

allow from    (Add your IP or range here)


RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]


Save the file and test.

Wednesday, August 26, 2020

How to install Mysql5.7 on Oracle linux 7

 By default Mariadb comes with Oracle linux 7. I need to have mysql on my box.

yum remove mariadb-server -y


rpm -ivh mysql57-community-release-el7-8.noarch.rpm

yum install mysql-server -y

systemctl start mysqld

systemctl enable mysqld

sudo grep 'temporary password' /var/log/mysqld.log


Saturday, August 15, 2020

How to install jenkins on amazon linux

How to install jenkins on amazon linux

 Following this steps to install jenkins on amazon linux

Login to the server

sudo wget -O /etc/yum.repos.d/jenkins.repo

sudo rpm --import

yum install jenkins

sudo service jenkins start

sudo chkconfig jenkins on

Open a browser, and access http://publicip:8080

Tuesday, May 5, 2020

Qmail error while installing and configuraing

Qmail error while installing and configuraing

After installing Qmail, i tried to start qmail i got this error

[root@localhost qmail-smtpd]# qmailctl start
Starting qmail...

qmail-send supervise not running
qmail-smtpd supervise not running
qmail-pop3d supervise not running

I checked all the possible issues,

[root@localhost qmail-smtpd]# ls -l /service
total 0
lrwxrwxrwx 1 root root 32 2010-08-16 21:38 qmail-pop3d -> /var/qmail/supervise/qmail-pop3d
lrwxrwxrwx 1 root root 31 2010-08-16 21:38 qmail-send -> /var/qmail/supervise/qmail-send
lrwxrwxrwx 1 root root 32 2010-08-16 21:38 qmail-smtpd -> /var/qmail/supervise/qmail-smtpd

[root@localhost qmail-smtpd]# ps ax |grep supervise
10190 pts/1 T 0:00 supervise log
10332 pts/1 S+ 0:00 grep supervise



'svscanboot' was not running

[root@localhost qmail-smtpd]# svscanboot &
[2] 10336
[root@localhost qmail-smtpd]# qmailctl start
Starting qmail...

Starting qmail-send
Starting qmail-smtpd
Starting qmail-pop3d

It works !!!! Seems like we have to reboot the server after installing daemontools.

How to untar a file in Sun Solaris10

Normally i am doing is like this " tar -xzvf file.tar.gz "
But here in Solaris10 its not working,

this will helps.

gunzip -c somefile.tar.gz |tar xvf -

How to upgrade php 5.1.6 to php5.3

My box is Centos 32bit

Following steps i have done, used yum remi repository

rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

yum --enablerepo=remi update php

Check php -v
rpm -qa | grep php

I forgot the admin user/password of moodle, but i have mysql access. How can i restore the admin password?

Login to the mysql prompt.
use table_name
update mdl_user set password='0192023a7bbd73250516f069df18b500' where  username='admin';

I know moodle is using MD5 encryption.
The above mentioned is MD5 encryption of admin123

Login to the admin panel with password admin123 It works!!!

Tuesday, April 28, 2020

mysqldump: Couldn't execute 'SHOW VARIABLES LIKE 'gtid\_mode'':

Issue happens when I take a mysqldump after I upgrade Mysql 5.5 to Mysql 5.7


[root@ip-10-26-91-168 mnt]# mysqldump -u userone -p db1 > db1.sql
Enter password:
mysqldump: Couldn't execute 'SHOW VARIABLES LIKE 'gtid\_mode'': Native table 'performance_schema'.'session_variables' has the wrong structure (1682)
[root@ip-10-26-91-168 mnt]#


Login to the server as root

# mysql_upgrade -u root -p --force
# systemctl restart mysqld

This helped to fix my issue :)

Sunday, March 15, 2020

Terraform for Absolute Beginners - Create your first EC2 instance

Objective : Today, I will help you to create your EC2 instance using terraform.


Terraform is an Infrastructure as code (IaC) tool made by Hashicorp for building, changing and versioning of infrastructures. Now a days the demand of Terraform is getting higher. Terraform can be used with the popular cloud providers like AWS, Azure, Google, Oracle etc.

Pre Request

You need a user in AWS, having necessary permissions to create an EC2 instance.
(Please check our blogs/videos, how to add permission for an AWS user)

Steps to Provision

  1. Download the terraform binary file from
  2. Extract the terraform zip file
  3. The result is a terraform binary file
  4. cp terraform /usr/local/bin/terraform
  5. Validate terraform by using the command terraform -v

Minimal configuration for starting EC2 instance

mkdir terraform-workshop
cd terraform-workshop

provider "aws" {
access_key = "YOUR_ACCESS_KEY"
secret_key = "YOUR_SECRET_KEY"
region = "us-east-1"

resource "aws_instance" "example_ec2" {
ami = "ami-2757f631"
instance_type = "t2.micro"

Save the file. 
You will get your AWS access_key and secret_key as a pre-request.

terraform init
terraform apply

Login to your AWS console and check the EC2 instance under N. Virginia region.

terraform destroy

Will make sure to remove all the AWS resources which we created just above.

Wednesday, February 5, 2020

Error: CERT_UNTRUSTED in npm install

In ubuntu18, when I tired npm install, I am getting the following error


Fix : Remove the current nodejs and npm and install the latest nodejs and npm version.
This will fix the error