1. Changing PHP version with Valet and Homebrew (OSX)

    Recently, I updated the PHP on my machine to version 7.4 using homebrew for Mac OS only to then realise that one of my older projects that I still needed to maintain, made on version 7.2 would no longer work due to using depreciated PHP functions such as array_key_exists.

    The long term solution to this would be to update the project so it’s compatible with PHP version 7.4, but for the sake of time, and potential fixes that needed to go out immediately, I needed to be able to develop this project in the environment it’s running in. Fortunately, I use valet to develop all my PHP applications a tool I can only recommend for PHP developers. Valet allows you to develop PHP applications on your local machine with a much higher level of ease than I’ve found using other services such as dockers or XAMP/MAMP.

    Valet, with the use of homebrew, supports switching your system PHP version at will to any version installable via homebrew. So switching versions can be as simple as th

    Read more »
  2. How to enable HTTP Strict Transport Security (HSTS) for your site

    How to enable HTTP Strict Transport Security (HSTS) for your site

    HTTP Strict Transport Security (HSTS) instructs web browsers to only use secure connections (https://) for all future requests when communicating with a web site. Doing so helps prevent SSL protocol attacks, SSL stripping, cookie hijacking, and other attempts to circumvent SSL protection.

    Read more »
  3. How to Configure Robots.txt in Magento 2

    As you know, configuring robot.txt is important to any website that is working on a site’s SEO. Particularly, when you configure the sitemapto allow search engines to index your store, it is necessary to give web crawlers the instructions in the robot.txt file to avoid indexing the disallowed sites. The robot.txt file, that resides in the root of your Magento installation, is directive that search engines such as Google, Yahoo, Bing can recognize and track easily. In this post, I will introduce the guides to configure the robot.txt file so that it works well with your site.

    Following steps to Configure robots.txt in Magento 2

    • On the Admin panel, click Stores. In the Settings section, select Configuration
    Read more »
  4. In Laravel 5, How to disable VerifycsrfToken middleware for specific route?

    In Laravel 5 this has changed a bit. Now you can simply add the routes you want to exclude from csrftoken verification, in $except an array of the class 'VerifyCsrfToken' (\app\Http\Middleware\VerifyCsrfToken.php):

    class VerifyCsrfToken extends BaseVerifier { protected $except = [ // Place your URIs here ]; }
    Read more »
  5. laravel csrf_token() is empty in l5-swagger

    csrf_token() is empty in l5-swagger and couldn't do any request.

    I have tried to request it from the postman and it works. but in swagger, it didn't. I have taken a look from this link (Laravel 5 csrf_token value is Empty) but I still have no idea how to solve my problem.

    How can I get the csrf_token inside my l5-swagger view?


     You should try to add this in /routes/web.php

    Route::group(['middleware' => 'web'], function () {
    Read more »
  6. Solving out of memory errors with PHP and Composer on EC2s free tier

    For one of my recent projects, I wanted to make use of the free allowance that AWS gives for SES.

    One of the conditions of the SES allowance was that your calling app needs to be hosted on EC2.

    I’ve not used EC2 before so I figured this would be a good way to dive into it.

    Whilst I would never usually install software like a composer on a production server, this was pure to test things out.

    So after signing up for AWS and creating a local ubuntu server on an EC2 t2micro instance then cloning down the project I ran composer install to come across the following message:

    composer install
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    mmap() failed: [12] Cannot allocate memory
    mmap() failed: [12] Cannot allocate memory
    PHP Fatal error: Out of memory (allocated 822091776) (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php o
    Read more »
  7. Upgrading to PHP 7 on Amazon Linux EC2 Instance

    By now you may know that PHP 7 has been available for quite some time now coming with a number of improvements over version 5. It may be wise to upgrade to PHP7 when running for instance a WordPress using Amazon AWS where you are responsible for any upgrades.

    Also as of July 2016, Amazon officially added PHP7 to its repository so you can install it using yum. So first thing I did was create a backup image of my EC2 instance before I went on with the upgrade. Once I had my backups done and proceeded with the PHP 7 upgrade.

    Here are the steps I took in order to upgrade from PHP 5.x to 7.

    Login to your Linux instance and perform the regular system updates first

    $ sudo yum update

    Stop the running webserver

    $ sudo service httpd stop

    Remove any existing PHP packages

    $ sudo yum
    Read more »
  8. How to Install Slack on Ubuntu 18.04

    Slack is one of the most popular collaboration platforms in the world that brings all your communication together. Conversations in Slack are organized in channels. You can create channels for your teams, projects, topics, or any other purpose to keep information and conversations organized. You can search through everything that’s been posted in channels or your messages. Slack also allows you to talk with your teammates over audio or video calls and share documents, images, videos, and other files.

    Slack is not an open-source application and it is not included in the Ubuntu repositories.

    This tutorial explains how to install Slack on Ubuntu 18.04. The same instructions apply for Ubuntu 16.04 and any other Debian based distribution, including Debian, Kubuntu, Linux Mint and Elementary OS.

    Read more »
  9. An error has happened during application run

    The topic today is one of the popular errors you will meet. As if the error message shows “An error has happened during application run. See exception log for details” in Magento 2 when you have uploaded Magento CE latest version and want to install it on your server, so what should you do? Here is the right solution for you.

    How to resolve: “An error has happened during application run. See exception log for details”

    Please open the .htaccess from the root and comment out the first line:

    SetEnv MAGE_MODE developer
    Read more »
  10. How to install phpunit on Ubuntu 16.04 (Xenial Xerus)

    Install phpunit

    Installing phpunit package on Ubuntu 16.04 (Xenial Xerus) is as easy as running the following command on terminal:

    sudo apt-get update
    sudo apt-get install phpunit
    Read more »
Copyright © 2016 Samdoit Infotech. All rights reserved.