Friday, July 13, 2018

Magento Cron readiness failed while installing extension

Please do the following.

php bin/magento cron:run
php update/cron.php
php bin/magento setup:cron:run

Wednesday, June 13, 2018

Enable mongodb in php7.1

Please follow the instruction below to enable mongodb in php7.1

1.) pecl install mongo

2.) edit php.ini and add

          extension=mongo.so

3.) restart server


upgrading Laravel 5.5 to 5.6


Please follow the instruction.

1. composer.json:
From:
"require": {
        "php": ">=7.0.0",
        "fideloper/proxy": "~3.3",
        "laravel/framework": "5.5.*",
        "laravel/tinker": "~1.0"
    },
To:
"require": {
        "php": ">=7.1.3",
        "fideloper/proxy": "~4.0",
        "laravel/framework": "5.6.*",
        "laravel/tinker": "~1.0"
    },
2. Replace app\Http\Middleware\TrustedProxies.php file with contents below:
php

namespace App\Http\Middleware;

use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;

class TrustProxies extends Middleware
{
    /**
     * The trusted proxies for this application.
     *
     * @var array
     */
    protected $proxies;

    /**
     * The headers that should be used to detect proxies.
     *
     * @var string
     */
    protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
3. composer update

Friday, May 11, 2018

Insalling Laravel

1) You need to install composer
cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer



2) create softlink in usr/bin to access it from any where
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer

3) Upgrade php version to 7.1

4) Install laravel using composer.

composer global require "laravel/installer"
sudo yum install -y php70-zip //ext-zip was missing after php7.0 installed.

5) create softlink of laravel command to access it from any directory
$ sudo ln -s /root/.composer/vendor/bin/laravel usr/bin/laravel

6) create laravel test project blog

7) Install  sudo apt-get install php-xml. in case dom extension is enable but composer gives error as not installed and retry.

8) to run laravel under apache rename the file server.php to index.php

9) copy .htaccess file from public to laravel application folder eg: $under_app_dir> sudo cp public/.htaccess ./

10) give write permission to storage and bootstrap/cache folder in your laravel project.

11) Start xamp if not running and load the app URL.

12) Note: Laravel5.3.x has route file in laravel application /route folder as web.php earlier it was under app/Http/route.php

13) go to project directory and run composer require guzzlehttp/guzzle:~6.0 to download guzzle lib used for REST API.

Sunday, March 11, 2018

Increasing volume size on EC2 Server

Increasing volume size or disk size on ec2 instance is as follows.

1) Log in to aws access contol system and select services > EC2 from the menu.

2) Under Elastic Block Storage click on the volume.

3) Select the volume which is to be increased. right click and click on modify volume.

4) Enter new size in GB for the volume and click save. Volume size will be increased.

5) Now you need to extend partition to the unused space. Login to your ec2 server using putty or other terminal tool.

6) Use the df -h command to report the existing disk space usage on the file system.  you will see output as below.
                     
              [ec2-user ~]$ df -h
             Filesystem            Size  Used Avail Use% Mounted on
            /dev/xvda1            8.0G  943M  6.9G  12% /
            tmpfs                 1.9G     0  1.9G   0% /dev/shm
            /dev/xvdf            1014M   33M  982M   4% /mnt


7) Expand the modified partition using growpart (and note the unusual syntax of separating the device name from the partition number):
        
           sudo growpart /dev/xvda 1
where xvdf is the disk and 1 is parition number.

you will get following output.
     
                        $sudo growpart /dev/xvdf 1
CHANGED: disk=/dev/xvdf partition=1: start=4096 old: size=16773086,end=16777182 
new: size=73396190,end=73400286

You can see old size has been modified to the new size.

8) Use a file system-specific command to resize each file system to the new volume
capacity.
For a Linux ext2, ext3, or ext4 file system, use the following command, substituting the device name to extend:  

you will get following output.

[ec2-user ~]$ sudo resize2fs /dev/xvda1
resize2fs 1.42.3 (14-May-2012)
old_desc_blocks = 1, new_desc_blocks = 3 

9)  Use the df -h command to report the existing disk space usage on the file system.  you will see output as below.

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1             70G  951M   69G   2% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/xvdf             100G   45M  100G   1% /mnt

Congratulation ! increaded volume size has been reflected to ec2 instance.