PHP & Magento Developer in Minnesota

Thank you for visiting my website. I’m Nick Bartlett and have over ten years professional experience as a web developer with both frontend and backend skills. I’m one of a handful of Zend PHP 5 certified engineers in Minnesota and have years of experience contracting for local and remote companies.  If you or your company needs help with any of the below areas, please contact me through this website or email nick at bartlett dot com.

  1. Object Oriented PHP 5
  2. High performance, high traffic PHP websites
  3. MySQL 5
  4. JavaScript / Jquery
  5. HTML/CSS
  6. Magento
  7. WordPress
  8. Zend Framework
  9. Yii Framework

Magento Error Warning: mcrypt_generic_deinit(): Could not terminate encryption specifier

I ran into the below error today while working with Magento 1 and registering a customer during checkout.

[10-Apr-2018 13:49:47] WARNING: [pool www] child 1731 said into stderr: "NOTICE: PHP message: PHP Fatal error:  Uncaught exception 'Exception' with message 'Warning: mcrypt_generic_deinit(): Could not terminate encryption specifier  in /var/www/myproject/htdocs/lib/Varien/Crypt/Mcrypt.php on line 135' in /var/www/myproject/htdocs/app/code/core/Mage/Core/functions.php:245"
[10-Apr-2018 13:49:47] WARNING: [pool www] child 1731 said into stderr: "Stack trace:"
[10-Apr-2018 13:49:47] WARNING: [pool www] child 1731 said into stderr: "#0 [internal function]: mageCoreErrorHandler(2, 'mcrypt_generic_...', '/var/www/myproject...', 135, Array)"
[10-Apr-2018 13:49:47] WARNING: [pool www] child 1731 said into stderr: "#1 /var/www/myproject/htdocs/lib/Varien/Crypt/Mcrypt.php(135): mcrypt_generic_deinit(Resource id #180)"
[10-Apr-2018 13:49:47] WARNING: [pool www] child 1731 said into stderr: "#2 /var/www/myproject/htdocs/lib/Varien/Crypt/Mcrypt.php(54): Varien_Crypt_Mcrypt->_reset()"
[10-Apr-2018 13:49:47] WARNING: [pool www] child 1731 said into stderr: "#3 [internal function]: Varien_Crypt_Mcrypt->destruct()"
[10-Apr-2018 13:49:47] WARNING: [pool www] child 1731 said into stderr: "#4 {main}"
[10-Apr-2018 13:49:47] WARNING: [pool www] child 1731 said into stderr: "  thrown in /var/www/myproject/htdocs/app/code/core/Mage/Core/functions.php on line 245"

The problem is the encryption key in app/etc/local.xml was empty. Add one to solve the problem.


The Phoenix Project book take aways

I just finished listening to the audio book of the Phoenix project. I had a few primary take aways from this book:
1. Reduce WIP (work in progress). I’ve been on projects in my career where when we’d get blocked on doing some work, we needed to keep the team busy so we’d pull in other work. Soon enough you’d have 100 initiatives going on at once that you’re able to devote to each only ten minutes per week. In this project we paused for two weeks where no new work was added and we just focused on completing the work already in progress. It reduces context switching and allows more work to get completed.

2. Automated builds and deployments. I’ve also been on teams where this has been done and it’s fantastic. Building and maintaining the tool itself takes effort, so plan for that. But, once it’s finished you can deploy all day with consistency and accuracy.

3. Identify your workflow’s constraint (bottleneck). Any improvements to the workflow that are not at the constraint are worthless.

4. Unplanned work prevents you from meeting your goals. Minimize this.

Here are a couple great resources for notes and take aways https://lalitkale.wordpress.com/2014/08/04/book-notes-the-phoenix-project-a-novel-about-it-devops-and-helping-your-business-win/ and https://uptakedigital.zendesk.com/hc/en-us/articles/115000524374-4-Types-of-Work-in-IT-The-Phoenix-Project-


How to update google compute engine instance

My google compute engine instance is running Debian.  As I’ve read, those running Centos and Redhat linux have a nightly yum update, but not servers running Debian Linux.  If you’re unsure which version of linux you have, run

cat /proc/version

My Debian Linux Google compute engine has apt-get installed and not yum. Run this command to have it check for and print updates; it won’t install them.

apt list --upgradable

If you haven’t upgraded software in a while, you’ll see a long list of packages that need to be updated.

There are a few different ways to install the updates as described here https://cloud.google.com/compute/docs/security-bulletins and here https://askubuntu.com/questions/194651/why-use-apt-get-upgrade-instead-of-apt-get-dist-upgrade . I usually run

apt-get -y dist-upgrade

Afterward if you run “apt list –upgradable” again it’ll just say “Listing… Done” since nothing needs to be updated.


Magento 2 vs Magento 1 pricing differences

Advanced Pricing

Advanced pricing is a section where you can setup specials and tiered pricing.  The functionality is the same as in M1, but they’ve just moved and renamed some functionality.

There are two kinds of advanced pricing in magento 2.

  1. You can set a special price for a date range, which was already available in M1.
    1. Special price to and from date is missing in Magento 2 EE. This is because Magento intentionally removed it from EE so admins would use scheduled updates instead.
    2. In addition to specifying a fixed price discount for tiered pricing, in M2 tiered pricing can be a percentage off discount.
    3. M2 has an input for product cost, which has no value that I can find.  It’s not in reports or anything; it does get inserted into the order quote though.

 

Configurable Products

In Magento 1, once the simple product is associated to the configurable, the simple’s price no longer matters; it’s not used.  It’s still visible when viewing the configurable’s simple products and adds confusion.  In M1 the variations’s pricing is based off the configurable’s price plus a difference of fixed amount or percentage.  The difference can be negative. 

In Magento 2, configurable variation pricing is one of the following:

  1. All simple variations inherit the price from the configurable
  2. A price is specified for each simple. The difference from M1 is, the price you specify isn’t based on the configurable’s price at all; it’s independent.  If the configurable’s price is $20, and you want this simple’s price to be $25, you’ll specify $25 in M2 instead of $5 in M1.  This works much better if you’re pulling in prices from an ERP that has the full price specified. 


Solved Windows 10 1709 Fall Creators Update failure 1

Once again updating my Windows PC, which is running Windows 10 and started life as Windows 7, was a major pain as the update to 1709 Fall Creators Update failed at 45% completion with the message “windows could not configure one or more system components”. What took me 7 hours of waiting through a dozen or more downloads of updates and reboots you get to read in a few minutes haha.

My previous solution to solve windows update errors using WSUS offline updater didn’t work this time around. The tool downloaded many updates, but then said no updates required. This was not true as I was running Windows 1607 and the current version is 1709.

A hint of the issue came from viewing the file C:\$Windows.~WS\Sources\Panther\setupact.log

2018-01-13 08:41:50, Info                  CSI    000000de ==Error Summary Start==
2018-01-13 08:41:50, Error                 CSI    000000df (F) Generic Command	ErrorCode: 80004005	Executable: iissetup.exe	ExitCode: 9	Phase: 38	Mode: Install (first install)	Component: Microsoft-Windows-IIS-SharedLibraries-GC, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=amd64, versionScope=NonSxS[gle=0x80004005]
2018-01-13 08:41:50, Info                  CSI    000000e0 ==Error Summary End==

There is something wrong with IIS, which I am not using on this computer. To solve this, on your computer click the search icon and type “windows features” and click the result “Turn windows features on or off”. I initially disabled IIS on my computer, rebooted and tried again. No luck, same issue. Hours later I Tried it again, only this time I came in with a bigger hammer and disabled Microsoft .NET framework 3.5 and 4.7, Internet Explorer 11, and Internet Information Services (IIS). Click “OK”, then reboot your computer. Then run the update again and this time it worked.

Afterward, I went back to windows features and enabled both .NET frameworks and Internet Explorer, but left IIS off. This required another reboot. Also, the upgrade deleted my video card driver, and updating it from the device manager failed. It an nvidia geforce 9500 and I was able to find and download the correct driver from their website for the fix.

All is good, until next time.