WHMCS and Hexonet ISPAPI Registrar Module “Missing Required Attribute; X-CA-LEGALTYPE” Issue

If you’re running WHMCS and the Hexonet ISPAPI Registrar Module, you might have issues registering .ca domain names. An error will show up when you click on register, here’s a screenshot of the error.

hexonet-ispapi-dotca-error

Invalid attribute value; INVALID Contact [OWNERCONTACT] (Missing required attribute; X-CA-LEGALTYPE)]

This is due to the .ca registry requiring all registrations require a legal type designation, there’s multiple types. Commonly used types are Canadian Citizen and Corporation.

The fix is to open up the file “modules/registrars/ispapi/additionaldomainfields_sample.php” which is either in the downloadable zip file or already in your WHMCS installation. The file contains the following additions domain fields that you need to place under “WEBROOT/resources/domains/additionaldomainfields.php”

## .CA DOMAIN REQUIREMENTS ##
## add ispapi additional fields ##
$additionaldomainfields[“.ca”][] = array(
“Name” => “Legal Type”,
“LangVar” => “catldlegaltype”,
“Type” => “dropdown”,
“Options” => “Corporation,Canadian Citizen,Permanent Resident of Canada,Government,Canadian Educational Institution,Canadian Unincorporated Association,Canadian Hospital,Partnership Registered in Canada,Trade-mark registered in Canada,Canadian Trade Union,Canadian Political Party,Canadian Library Archive or Museum,Trust established in Canada,Aboriginal Peoples,Legal Representative of a Canadian Citizen,Official mark registered in Canada”,
“Default” => “Corporation”,
“Description” => “Legal type of registrant contact”,
“Ispapi-Name” => “X-CA-LEGALTYPE”,
“Ispapi-Options” => “CCO,CCT,RES,GOV,EDU,ASS,HOP,PRT,TDM,TRD,PLT,LAM,TRS,ABO,LGR,OMK”
);
$additionaldomainfields[“.ca”][] = array(
“Name” => “CIRA Agreement”,
“LangVar” => “catldciraagreement”,
“Type” => “tickbox”,
“Description” => “Tick to confirm you agree to the CIRA Registration Agreement shown below
You have read, understood and agree to the terms and conditions of the Registrant Agreement, and that CIRA may, from time to time and at its discretion, amend any or all of the terms and conditions of the Registrant Agreement, as CIRA deems appropriate, by posting a notice of the changes on the CIRA website and by sending a notice of any material changes to Registrant. You meet all the requirements of the Registrant Agreement to be a Registrant, to apply for the registration of a Domain Name Registration, and to hold and maintain a Domain Name Registration, including without limitation CIRA’s Canadian Presence Requirements for Registrants, at: www.cira.ca/assets/Documents/Legal/Registrants/CPR.pdf. CIRA will collect, use and disclose your personal information, as set out in CIRA’s Privacy Policy, at: www.cira.ca/assets/Documents/Legal/Registrants/privacy.pdf
“, “Required” => true, “Ispapi-Name” => “X-CA-ACCEPT-AGREEMENT-VERSION”, “Ispapi-Eval” => ‘if ( $value ) { $value = “2.0”; } else { $value = “”; }’ ); $additionaldomainfields[“.ca”][] = array( “Name” => “WHOIS Opt-out”, “LangVar” => “catldwhoisoptout”, “Type” => “tickbox”, “Description” => “Tick to hide your contact information in CIRA WHOIS (only available to individuals)”, “Ispapi-Name” => “OWNERCONTACT0X-CA-DISCLOSE”, “Ispapi-Eval” => ‘if ( $value ) { $value = “0”; } else { $value = “1”; }’ ); $additionaldomainfields[“.ca”][] = array( “Name” => “Trademark Number”, “Type” => “text”, “Size” => “50”, “Default” => “”, “Required” => false, “Ispapi-Name” => “X-CA-DOMAIN-TRADEMARK”, “Ispapi-Eval” => ‘if ( $value ) { $value = “Y”; } else { $value = “N”; }’ ); $additionaldomainfields[“.ca”][] = array( “Name” => “Contact Language”, “Type” => “dropdown”, “Options” => “English,French”, “Default” => “English”, “Ispapi-Name” => “X-CA-LANGUAGE”, “Ispapi-Options” => “EN,FR” );

WordPress Speed Up Analysis 2019-06-03

The following was a post I made on the WordPress Speed Up FaceBook Group. I thought it was worth posting here in-case someone else might be looking for something similar.

Olly Bee Excellent! First load for me was a white page without CSS being applied. Which is weird, I haven’t gone to the site before. So you might want to watch out for that, or maybe you were just making changes.

You’re not loading many assets which is great, mostly due to breeze combining css and js (assumption here since I see breeze.css). Just to note minification isn’t required for a great experience for customers. It’ll get you get you good scores on GTMetrix/PageSpeed but you’ll have to way usability for great gtmetrix scores.

Ue the built in Dev Tools in Chrome and look specifically at the Network page and waterfalls. Find items that are taking a long time to load, and see if they have any cache headers. Reload the page and see if they’re loading faster and if the cache headers appear.

When looking at all the items loading, the document items are usually html or PHP. This is where server resources come into play. If you’re getting higher load times on documents, it’s most likely due to caching not being in-play. Or it’s just a dynamic page (PHP) that can’t be cached (WooCommerce checkout, but even then LiteSpeed can use ESI blocks which makes it easier). If you can’t cache a page, then the server resources come into play. Specifically CPU, PHP its a CPU hog. Facebook tried to fix this by implementing compiled PHP using HHVM, but ditched PHP all together. Each time you have to load a PHP page, it has to be compiled by the server. You want to limit this as much as possible. WordPress deals with this fine as a vanilla installation. Once you add plugins, load times start to increase.

When I first loaded your portfolio page, I noticed it took about 3ms to load all assets. I looked at all the headers of each request and found that the main request for /portfolio had a x-cache miss and a high load time. Once I refreshed the page this load time went down. So it’s possible caching was put into play here either through Varnish or NGiNX fastcgi cache. Hard to tell, would have to look at your stack more.

If there’s caching in play, a header should appear. Most of the time this is configured, but not always.

Once your cache is filled, it looks like your pages load faster. So you might need to tweak your cache TTL. Which just tells the cache how long to keep things. This is great for static pages, but for anything dynamic it might cause issues. Most caching plugins deal with this automatically. Even CloudFlare does well with this if you setup the proper page rules. CloudFlare by default doesn’t do well with a WordPress site.

Aside from that, I see that .tff files aren’t being cached and have 400ms load tims where all your images are loading within 20ms which is great. That’s because most of them are from your StackPath CDN. And they’re small, which helps!

Another issue I noted is that your query stringed static assets aren’t being cached. Which is a common issue, so you can either enable this in CloudFlare via a rule. Or you can look at a plugin like Clearfy or Perf Matters. If you want to save money, there is code out there to simply just do this specific task.

Also, with the above plugins you can remove the wp-emoji-release.min.js and dashicons.min.css from loading. Again you most likely aren’t using them, but test anyways.

Hope that helps, Cheers!

MySQL 8 and Persona 8 Tuning for WordPress

If you’re running MySQL 8 or Percona 8, then you’ll probably see lots of guides online that reference some out of data configuration that really only deals with functions in MySQL 5 that have been deprecated in MySQL 8 and Percona 8

Query Cache

No longer used, and removed from MySQL 8 and Percona 8, alternative is ProxySQL as per the following Percona article https://www.percona.com/blog/2018/02/07/proxysql-query-cache/

Creating Users and Databases in MySQL 8 and Percona 8

If you’ve started using MySQL 8, you’ll notice your usually commands for creating a user no longer function. That’s because it’s changed in MySQL 8, you need to now create a user, then grant privileges.

Let’s create a user

CREATE USER ‘newuser’@'localhost' IDENTIFIED WITH mysql_native_password BY ‘user_password';

The critical part here is the “mysql_native_password” if you don’t have this portion, you’ll get errors like the following.

PHP Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in mysql_test.php on line 8
PHP Warning: mysqli_connect(): (HY000/2054): The server requested authentication method unknown to the client in mysql_test.php on line 8

This is due to the default authentication plugin being set to sha2, you can change it back to native by adding the following into your my.cnf

default-authentication-plugin=mysql_native_password

Now let’s grant the user privileges.

GRANT ALL ON database_name.* TO ‘newuser’@'localhost';

Now confirm the privileges.

SHOW GRANTS FOR 'newuser’@'localhost';

Maybe you want to Update a Password

ALTER USER ‘root'@'localhost' IDENTIFIED BY 'MyNewPass';

Fix the “The package could not be installed. PCLZIP_ERR_BAD_FORMAT” WordPress Error

This is pretty straightforward, you’ll see this error when updating or installing a plugin.

[enlighter linenumbers=”true”]The package could not be installed. PCLZIP_ERR_BAD_FORMAT[/enlighter]

Basically the file WordPress is trying to download is either corrupt or you don’t have the PHP curl module installed. So simply install it, for Ubuntu this is:

[enlighter linenumbers=”true”]apt-get install php-curl[/enlighter]

or

[enlighter linenumbers=”true”]apt-get install php7.3-curl[/enlighter]

Searching WordPress MySQL Dump Files

From time to time, you’ll need to look at data within MySQL dump files, specifically I do it mostly with WordPress. There isn’t an easy way to search the dump unless you use grep. Here are some useful grep commands.

Pull out a table.

[enlighter linenumbers=”true”] grep ‘INSERT INTO `wp_bspr_users`’ dump.sql > /tmp/users.sql [/enlighter]

Format a table in a readable format.

[enlighter linenumbers=”true”]cat dump.sql | grep ‘INSERT INTO `wp_users`’ | sed ‘s/),/’$’n/g’ [/enlighter]

Now if you run a popular shell like csh, you can add the following function.

[enlighter linenumbers=”true”]msd () { grep “INSERT INTO \`$2\`” $1 | sed “s/),/\’$’\n/g” }[/enlighter]

[enlighter linenumbers=”true”]Then run the following[/enlighter]

msd dump.sql wp_users

This might work, don’t know!

Don’t Buy WeMo Smart Plugs

So I bought a 3 pack of the WeMo Smart Plugs in the hopes of yelling “Alex turn Bedroom Light Off” before bedtime. Instead of buying a Clapper, of which I’ve never seen in real life. 

Which was probably a better idea seeing as the WeMo Smart Plugs are notorious for disconnecting from Wifi or having general issues connecting with HomeKit.

There are tons of community posts about this issue on the WeMo community forums.

All the issues on the WeMo Community Forums

Unfortunately you can’t view the posts unless you register an account. Good luck, as their registration page is also broken.

WeMo Community Forums Registration Broken

I had bought the WeMo Smart Plugs based on The Wire Cutters Best Smart Switch review, of which WeMo is number one.

If you read the Disqus comments, you’ll see that’s not really the case. Most of the comments talk about how the WeMo is unreliable.

Oh and you’ll notice that sometimes after the WeMo is registered as a device in the mobile app. It’s unsecured Wifi is still active and you can still connect to it.

 

Anyone interested in the wemo mini please be aware that there is currently a security issue with the latest iteration of hardware. When using the latest version the setup network stays active after the device is setup. It may go away at first but will turn back on after the device loses power or loses connection to your router.
Belkin has told me they had a similar issue with their previous hardware last year and was able to fix it with a firmware update, but there is currently no fix for the current version.
Early replies from their technical support claimed that the setup network is “inactive” after setup, and that although it may broadcast the network no one can perform any actions with the device over this network after setup.
This is not true. The setup network can be connected to and the device can be operated by anyone connected to the setup network.
If you currently have the device, as of Feb 22nd 2019, there is currently no solution but to unplug your devices.
Please see details on the issue in their support form.
https://disq.us/url?url=https%3A%2F%2Fcommunity.wemo.com%2Ft5%2FWEMO-Hardware%2FWifi-Setup-network-broadcasting-constantly%2Fm-p%2F51663%2Fhighlight%2Ftrue%23M19326%3AZZvw-24FQM8kz7xZwJQf-Dtokcc&cuid=1030491

For now I’m going to do some research but would love to know what others are using and having success with!

Booster for WooCommerce Showing Hidden Item Meta

If you have the Booster for WooCommerce plugin enabled and have used their order items table, specifically “[wcj_order_items_table]”

You might see item meta that should be hidden. I’ve created a GitHub Gist that you can place into wp-content/plugins

https://gist.github.com/jordantrizz/52d261567765c4ab8c1ffdab2aa9cdff