Magento2 CLI: Set Ubuntu PHP Version to match LAMPP/XAMPP

The Magento2 Comand Line Interface (CLI) needs to use the same version of PHP as your local web environment. You can check this by setting up an info.php script with in it “<?php phpinfo();” and comparing the output with the command “$ which php“.

You may find you are running two different versions of PHP each with its own PHP executable: by default one will be located in /usr/bin and another in somewhere like /opt/lampp/bin.

If you want to execute /opt/lampp/bin/php instead of /usr/bin, open your .bashrc file

sudo nano ~/.bashrc

At the very end add a new line:

PATH=/opt/lampp/bin:$PATH

Once you have saved .bashrc, run the command:

source .bashrc

You will now find bash is running the same PHP version and environment as your web server

Enable Magento2 Command-Line Interface (CLI) on Linux

For both development, ongoing management and scheduled tasks Magento’s Command Line Interface is able to do it all.

To enable CLI for Magento to you’ll need to make sure the file /bin/magento is executable by the system.

If you’re on the server SSH into the root of your Magneto install and run the command

chmod +x bin/magento

If you’re on desktop simply locate the file in your file explorer, right click and set the “Allow executing file as program” checkbox on the Permissions tab.

The latest update to PHP7 is here… 7.2.0

This month PHP released the latest update PHP7.2.0. While PHP 7.2 is an improvement, it is not groundbreaking as the jump from PHP5.6 to PHP7.0. However the biggest change, having encryption as part of the standard library in PHP, is very exciting. As PHP7 evolves and developers get more interesting tools to work with there are more and more reasons for dumping PHP5 and embracing the change.

Amongst the security updates there are a few cool new features and a couple of significant deprecations. Carlo Daniele has compiled a list here.

Running web applications on PHP7.2.0

Magento2 & PHP7.2.0

If you’re running Magento2 now might not be the best time to upgrade your PHP installation. It is important to note that both each() and mcrypt() have been removed from PHP 7.2. So stick with PHP 7.1, it doesn’t reach its end of life until 2019. Full list M2 requirements from Magento.

Magento 1 & PHP7

Out-of-the-box Magento 1.X installs are not designed to run on PHP7 at all. If you really need to run Magento 1.X on PHP7 Inchoo have created an our open-source compatibility extension for Magento and PHP 7 with impressive speed improvements. Details here

WordPress & PHP7.2

As you’d expect as long as your WordPress install is up to date it’ll run fine.

CMS blocks disappear after version 1.9.2.2 upgrade or SUPEE-6788 patch

Magento veresion 1.9.2.2 and patch SUPEE-6788 both introduce a new security featuer to Magento. Blocks on the front-end have to be enabled or whitelisted before it will work.

Blocks can be added via a new Admin Panel section under Permissions > Blocks. Adding or allowing a new block is pretty streight forward:

  1. Navigate to System > Permissions > Blocks
  2. Click “Add New Block”
  3. Enter the block name: e.g. cms/block*
  4. Set “Is Allowed” to Yes

* Replace this with the name of the block that has disappeared

Why is WordPress so popular?

WordPress is a free and open source software used by millions of people around the world to create websites and blogs. The most popular features of WordPress include its ease of use and ability to be extended way beyond the simple blog software it starts out as.

WordPress Northern Ireland

I’ve been developing WordPress websites for 10 years and am always looking for the next exciting project from personal blog, community portal or business website. Why not get in touch to see if I can help you with yours.

Front-end themes and templates can be easily downloaded from the official WordPress site or from hundreds of other places around the web. The same goes with extensions and plugins, which are used to extend the functionality of your WordPress site. A wide range of people contribute time, knowledge and skill to keeping the core WordPress software updated and secure.

There’s also a huge number of designers, developers & bloggers who share their knowledge through blog posts, tutorials, reviews, videos and the creation of thousands of themes & plugins.

It is estimated that WordPress could power as much as 29% of the world wide web. It is used for everything from personal blogs to large corporate websites with an even wider range of uses. From news sites and magazines to full e-commerce and online booking systems.

GDPR: What is the EU General Data Protection Regulation?

The General Data Protection Regulation (GDPR) will have an impact on how organisations handle the personal information that they look after.

GDPR is a regulation by which the European Parliament, the Council of the European Union and the European Commission intend to strengthen and unify data protection for all individuals within the European Union (EU). It also addresses the export of personal data outside the EU. The GDPR aims primarily to give control back to citizens and residents over their personal data and to simplify the regulatory environment for international business by unifying the regulation within the EU.

GDPR will have a role in four main areas:

1. Easier Access
Users will have easier access to their own data. Individuals will be better informed as to how their information is processed and stored and organisations will need to inform users in the clearest way possible.

2. Portability
Users should easily transfer their own information between service providers.

3. Right to be forgotten
Users that no longer want you to control or store their personal information you have processed should be able to easily have their data removed from your system unless there are legitimate grounds for keeping it.

4. Data breaches
Users should know that their information has been lost/stole or otherwise compromised. If your systems have been breached the users affected should be informed as soon as possible.

The implementation of the four points will depend on how you currently store and access user information. You will also need to be clear what you are using that information for.

 

Spammers: Murphy Consulting

You’ll have picked up from previous posts, I really don’t like spam. Running a website with a contact form I get a fair bit but occasionally I get spammed by what otherwise looks to be a reputable company and I have to call them out on it.

At Murphy Consulting (www.murphyconsulting.us) their number one goal is to create a mutually beneficial relationship with their partner, keep them happy and earn repeat business.

The spamming itself has been outsourced to the Philippines. Which itself is worrying for anyone taking-up Murphy Consulting as a web designer/developer or SEO agency. Brian Murphy at Murphy Consulting is already well known as a spammer. They are also known for ignoring SPAM warnings and violating terms of use of websites like this example.

If their own marketing capabilities are anything to go by they are best avoided.

I tried contacting Murphy Consulting via their Facebook and the Twitter account of another company that shares their office. Patrick Murphy and Brian Murphy are yet to respond to requests for help.

No response this far.

 

https://twitter.com/Keithology/status/940170964117151745

Spammers: Lee Andrew Meranda

I’ve been getting spammed by a company called The Compensation Specialist. They are a personal injury outfit. I’m not sure how they got my email but I didn’t subscribe and we don’t have an existing relationship, both are required for a UK company to send unsolicited email marketing material.

The rules on electronic mail marketing are in regulation 22. In short, you must not send electronic mail marketing to individuals, unless:

  • they have specifically consented to electronic mail from you; or
  • they are an existing customer who bought (or negotiated to buy) a similar product or service from you in the past, and you gave them a simple way to opt out both when you first collected their details and in every message you have sent.

You must not disguise or conceal your identity, and you must provide a valid contact address so they can opt out or unsubscribe.

I can’t seem to find any online or email contact details so might have to send this post out to him at his registered address.

Edit: Found an email address for one of Lee’s other companies, I’ll email there to find out wasssup.

The link in the spam email directs through to a contact form, which handily includes Mr Meranda’s companies record with the Crisis Management Regulator.

The Claims Regular provides an outline of Lee’s organisations. I’ll see if I can contact him through one of those.

Other trading names include: UK Claim Experts, Accident Compensation Alliance, 60 Second Claim, UK Claim Lawyers, Nationwide Injury Lawyers, Smart Compensation

How to update your hosts file.

Every computer has a file on it which allows the owner to specify where a website is loaded from. A hosts file is a simple combination of domain names and IP addresses.

Adding a record to your hosts file means your computer will load the domain using the IP address specified, rather than the one provided by DNS.

111.222.333.444 www.domain.com
111.222.333.444 domain.com
111.222.333.555 subdomain.domain.com
  1. Press the Windows key.
  2. Type Notepad in the search field.
  3. Right-click on the Notepad result
  4. Select Run as administrator.
  5. From Notepad, open: C:\Windows\System32\Drivers\etc\hosts
  6. Add the new lines to the file.
  7. Click File > Save to save your changes.
  8. Exit Notepad
  1. Open a terminal window.
  2. Open the hosts file in a text editor (you can use any text editor) by typing the following line:
    sudo nano /etc/hosts
  3. Enter your domain user password.
  4. Make the necessary changes to the file.
  5. Save the file
Good luck.

Mac OS X 10.0 through 10.1.5

  1. Open /Applications/Utilities/NetInfo Manager.
  2. To allow editing of the NetInfo database, click the padlock in the lower-left corner of the window.
  3. Enter your domain user password and click OK.
  4. In the second column of the browser view, select the node named machines.

    The third column contains entries for -DHCP-broadcasthost, and localhost.

  5. In the third column, select localhost.
  6. From the Edit menu, select Duplicate. (The quickest way to create a new entry is to duplicate an existing one.)

    A confirmation alert appears.

  7. Click Duplicate.

    A new entry called localhost copy appears, and its properties are shown below the browser view.

  8. Double-click the value of the ip_address property and enter the IP address of the other computer.
  9. Double-click the value of the name property and enter the hostname you want for the other computer.
  10. Click the serves property and select Delete from the Edit menu.
  11. From the File menu, select Save.

    A confirmation alert appears.

  12. Click Update this copy.
  13. Repeat steps 6 through 12 for each additional host entry that you want to add.
  14. From the NetInfo Manager menu, select Quit.

    You do not need to restart the computer.

Mac OS X 10.6 through 10.12

  1. Open Applications > Utilities > Terminal.
  2. Open the hosts file by typing the following line in the terminal window:
    sudo nano /private/etc/hosts
    
  3. Type your domain user password when prompted.
  4. Edit the hosts file.

    The file contains some comments (lines starting with the # symbol), and some default hostname mappings (for example, 127.0.0.1 – local host). Add your new mappings after the default mappings.

  5. Save the hosts file by pressing Control+x and answering y.
  6. Make your changes take effect by flushing the DNS cache with the following command:
    dscacheutil -flushcache

The new mappings should now take effect.

Magento Server Transfer – Tried and Tested Method

Moving an entire Magento site from one server to another or between hosts can be a daunting task for non-server administrators.

I’m going to try and expand this over time.

  • Agree time frames, a day for file system sync, an hour for database update and DNS update.
  • Content Freeze – no new images or content is added by Store owner, customers continue to place orders and create accounts.
    • A copy of the site is downloaded to the new server via FTP
    • A snapshot of the database is taken and used to test the site on the new server
  • Database Freeze – no new orders, holding page on the front end, Admin Panel still accessible if required but no updates allowed.
    • Export/import database
      • Old Server: mysqldump -u YourUser -p YourDatabaseName > wantedsqlfile.sql
      • New Server wget http://www.yourwebsite.com/wantedsqlfile.sql
      • New Server: mysql -u YourUser -p YourDatabaseName < wanted.sql
    • Copy over/configure your SSL for the new site
    • Next-up is the DNS update to repoint the domain
  • Done

 

Magento: What are Sage Pay Orphan Transactions?

This is a regular issue when using Sage Pay with Magento that needs a bit of explaining.

Sage Pay transactions started by the customer are stored in the Magento database. When a transaction is completed successfully this Sage Pay transaction is linked to the completed order in Magento.

When a order does not complete this leaves transactions in the Magento database not connected to a Magento order ID. These are orphaned transactions. The cause can be the customer abandoning the order at some point (e.g. the 3D secure checks), a declined/rejected payment, or caused by an error when Magento Saves the order. Because there is no completed Order ID to connect the transaction to these are considered “orphans”.

Orphaned  transactions are not always bad. If you monitor the list of orphaned transactions in Magneto (Sales > Sage Pay > Orphan Transactions) you can use the details to recover lost sales, for example a telephone or email address may be available to contact customers who have been unable to complete 3D Security checks and enter the order manually.

The most important thing to note is that Sage Pay integration will not tell Magento to save an order unless the payment has been successfully taken. The successful payment response from Sage Pay will create the “processing” order in Magento. This stops issues with inventory and shipping unpaid for orders.

The Sage Pay Suite Orphan Transaction list will not only help you spot issues with customers processing orders, it can also help you recover sales.

Testing YouTube embedded video responsiveness in WordPress

It turns out YouTube video uploads have come a long way since I last tried them out. This is a test post with no discernibly interesting content. WordPress has, for quite a long time allowed embedding YouTube content simply by copy and pasting the URL into the WordPress post editor.

Checking-out how WordPress handles YouTube embeds, whether or not they are responsive and if not how I can make them work better.

Update

So it turned out that the standard embed method will add a fixed width video iframe into the page. To make this responsive a couple of additions were required.

First wrap YouTube embed iframes in a container. Add the following script to your theme functions.php script

add_filter('embed_oembed_html', 'wrap_embed_with_div', 10, 3);

function wrap_embed_with_div($html, $url, $attr) {
    return "<div class=\"responsive-container\">".$html."</div>";
}

Then add a little bit of CSS to your themes style.css or wherever your main CSS file is

.responsive-container { position: relative; padding-bottom: 50.25%; padding-top: 30px; height: 0; overflow: hidden; margin-bottom: 1em; }
.responsive-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%;}

And that did the job.


WordPress developer

in Belfast, Northern Ireland

I’ve been developing WordPress websites for 10 years and am always looking for the next exciting project from personal blog, community portal or business website. Why not get in touch to see if I can help you with yours.

Contact me today!

Session Management and Validation Settings in Magento Configuration

Cookie and session management is an important aspect of any ecommerce store. Everything from a customer’s cart, checkout process and recently viewed products is made possible by knowing who is using the website. This is where cookies come into play.

The Session Cookie Management options specify how and where cookies are set and used in your Magento store.

The Session Validation Settings ensure the safety of the information stored in sessions by checking known information gathered from previous visits by a customer matches the current information.

Session Cookie Management

session-cookie-management
  • Cookie Lifetime is the time a cookie will remain ‘alive’ if the customer returns to the website within this timescale (in seconds) their cart/checkout/details will have been stored. If the cookie expires that information is no longer available to the customer
  • Cookie Path will usually just need a forward slash “/”, that means the cookie will be available across the domain and nto be limited to a specific directory.
  • The Cookie Domain will usually be your domain name preceded by a dot, and excluding the “www”. This means the cookie will be available on all sub domains
  • Use HTTP Only should usually be set to ‘yes’, this means that the cookie will remain active as the user switches between http:// and https://. If this is set to ‘no’ you will experience the customer’s cart emptying as they switch between non-SSL and SSL versions of the site, which is usually when clicking through through to the checkout.
  • Cookie Restriction Mode will notify your visitors that cookies are required for full-featured operations. It relates specifically to EU cookie directive.

Session Validation Settings

session-validation-settings
  • Validate REMOTE_ADDR checks that the customer’s public IP address is the same
  • Validate HTTP_VIA verifies that the proxy address of an incoming request matches what is stored
  • Validate HTTP_X_FORWARDED_FOR checks that the forwarded-for address of a request matches what was stored previously.
  • Validate HTTP_USER_AGENT checks that the browser/device matches previous visits.
  • Use SID on Frontend adds a ID to the end of URLs that allows Magento to recognise visitors as they pass between domains set-up on the one Magento install.

Why you should be using Magento for your ecommerce website

There are many ecommerce platforms around, many offer a similar experience but time and time again Magento comes to the top of the list. Magento is the fastest growing eCommerce platform on the internet.

Magento Development

From a technical perspective it is a free and open-source platform which means for it is an affordable choice for even the smallest business. It also has the backing of some of the world’s largest retailers such as Nike, The North Face, Rosetta Stone, Mother Care, Olympus even Ford for their accessories website.

Magento Integrations

Magento, through extensions, provides a wealth of integrations which make incorporating it into your business workflow easy and cost effective. services like SalesForce.com, Sage Accounting, Google, Constant Contact, Sage Pay, PayPal, Worldpay, Royal Mail and Parcel Force amongst others integrate seamlessly with your Magento set-up.

Magento is designed to make getting your catalogue online as easy and seamless as possible.

You win Google: I’m Moving from keith.kg to keithgreer.uk

Google’s automatic identification of a website’s intended audience using the top level domains means my .kg domain name has been slowly sliding down the rankings in Google.

I’ve finally bit the bullet and gone to a more standard .uk domain name. Should say .eu, .ie and .co.uk were also available but I weighed the odds and went for the more modern .uk with 301s all over the show. I’ve also taken the opportunity to move hosting from Blacknight to Spiral Hosting.

I would like to thank my domain providers from the great and glorious KG Kyrgyz Republic. Their odd little top level domain was a pleasure to use, but it is time to go home.

It was good while it lasted.

Саламатта калыңыздар, Мен сени сагындым.

Ак жол каалайм!