Running commands on Travis CI before composer self-update runs

I have the following .travis.yml file:

language: php

matrix:
  include:
    - php: 5.3
      dist: precise

before_install:
  - wget --no-check-certificate https://curl.se/ca/cacert.pem
  - echo "openssl.cafile=~/cacert.pem" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini

The problem is that when it runs I get the following error:

  [Composer\Downloader\TransportException]                                     
  The "https://getcomposer.org/versions" file could not be downloaded: SSL op  
  eration failed with code 1. OpenSSL Error messages:                          
  error:14090086:SSL routines:func(144):reason(134)                            
  Failed to enable crypto                                                      
  failed to open stream: operation failed

As I understand it that error means that the cert on the website couldn’t be validated. No doubt because my CA certs are too old. I’m doing wget --no-check-certificate https://curl.se/ca/cacert.pem and echo "openssl.cafile=~/cacert.pem" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini in before_install BUT it’s still being ran after Travis CI does composer self-update.

Any ideas how I can get the above commands to run before comoposer self-update instead of after?

Also, yes, I’m aware PHP 5.3 has been EOL for years. That doesn’t invalidate my question.

Imprint