SSL unable to get local issuer

If you have installed an SSL certificate and appears to work fine in the browser, but does not work on places like the W3 feeds validator or iTunes Connect, a good way to debug it is to use cURL from the command line.

You may get back an “unable to get local issuer certificate” error.

$ curl https://www.your-domain.com/
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

If so, this means that you have successfully installed your SSL certificate, but you have not included the intermediate certificates. These form an essential part of the chain up to the root certificate and need to be included when you install it.

They are typically distributed in .bundle files that come with your .crt file.

Fixing image corruption in Git

You may find that all the images you commit to a git repo are corrupting. This is especially true if you are using Windows and then pushing to a Linux origin.

One possible fix is to ensure the images are being treated as binary files. Of course everything is a binary file when it comes down to it, but this differentiates it from text. To do this, add the following lines to a .gitattributes file in the root of the repo.

*.jpg binary
*.png binary
*.gif binary

If you have images in there already, you will probably need to remove them and then re-commit them.

cURL SSLv3 calls failing

If you try and connect over HTTPS/SSL with cURL you may get an error similar to:

sslv3 alert handshake failure

Or:

Unknown SSL protocol error in connection

If you cannot see a descriptive error message, use –verbose to report everything.

The cause of this often that hosts have disabled SSLv3 because it has now been compromised. The solution is to use TLS, which is a newer more secure protocol.

curl --tlsv1 --verbose hostname

If you are using cURL in PHP you can change the SSL version to use TLSv1.2.

CURLOPT_SSLVERSION => 6

You should then be able to make the cURL request over SSL successfully.

Create hook templates in Git

Hooks are scripts that you can use to run additional code when running Git commands. They are not stored in the repository so need to be set up on each computer individually.

You can create templates for your hooks that will be used whenever you create a new repository. To do this, put your scripts into the template folders on your local machine.

On Linux:

/usr/share/git-core/templates

On Windows:

Program Files (x86)\Git\share\git-core\templates

When you next run git init you will then have these templates installed by default. Additionally, you can run git init in existing repositories to update the templates (it will not do any damage to the repo itself).

Troubleshooting xdebug profiler

Xdebug can be used to profile your PHP applications. However, it can be difficult to configure and get working. There are a number of gotchas to look out for.

Enabling

To enable the profiler on every request you can use the setting:

xdebug.profiler_enable = 1

If you want to just enable it for certain requests you can use:

xdebug.profiler_enable_trigger_value

This will allow you to use ?XDEBUG_PROFILE=1 in your query string. However, if you are using mod_rewrite to rewrite your URLs in Apache, you need to make sure the rule has the [QSA] flag in it to pass the query string through or this will not work.

Output direcotry

You can set the output directory to whatever directory you wish using the output dir setting:

xdebug.profiler_output_dir = '/tmp/xdebug'

However, xdebug will not create this directory for you. You need to manually create the directory and give write permissions to the web server too.

Enable gzip compression in cPanel

Using gzip compression allows you to deliver website content faster as it can be gzipped on the server and uncompressed on the client, reducing the file size you need to transfer.

Unfortunately mod_deflate, the Apache module required to do this, is not enabled on all cPanel installs. However, if it is, or you have access to the server, you can easily enable it.

Enabling mod_deflate

If you do not have mod_deflate, you need to use EasyApache to add it. Log in to Web Host Manager and go to EasyApache (only server admins will be able to do this). Select build from the previous configuration and customise it until you get to the exhaustive options list.

Check the box next to mod_deflate and then re-build Apache.

Enabling compression

Once you have mod_deflate enabled, cPanel will have a new option. Under “software and services” in the x3 skin you fill find an option called “optimise website”. Click through to that page.

Compress content will probably be set to “disabled”.

Select “Compress the specified MIME types” instead. You could enable it for all content but I would not recommend this as some content you will not want to compress and much of it (images for example) is pretty pointless. The third option allows you to customise.

By default it should have the following options:

text/html text/plain text/xml

I recommend adding some more:

text/html text/plain text/xml text/css text/javascript

Hit “update settings” and you are done!

Symlink Git on cPanel

These days cPanel comes with Git. However, it is not available as a command by default but is instead hidden away in cPanel’s usual obscure location.

However, you can make it accessible using a symlink.

ln -s /usr/local/cpanel/3rdparty/bin/git /usr/local/bin/git

That will allow you to use the git command as normal. The version you get is likely to behind the current version of Git though.

A new look for 2015

We’ve been using the Brand New Day theme for years now and we love it. It has a big happy picture of the sun, which is just the pick-me-up when your down because something is broken and needs fixing.

However, it does not work well on mobile devices. This is a real problem for us because if you’re on our site, it is often because your computer is broken and you are trying to fix it. So there is a good chance you are searching around on a mobile device to work out how to get it to turn back on again.

Our new theme works much better on mobile devices and provides a cleaner way to access the information. We hope you will like the change too!