0%

This is a rewrite of an old joke regarding PHP I did a while back. PHP has come a long way since but I think my description still stands today. I got the original idea after reading this: **If Programming Languages Were Cars.

Here’s my take on PHP as a 'car':

PHP Logo

PHP was a mountian bike that got crow barred into a tricycle. Its had a lawn mower engine strapped to its rear wheels and a turbo made from washing machine ducting kitted round the front. To keep it all going a set of stabilisers and prayer beads have been chucked on. The only thing that rea;lly makes it a car is that in most countries it needs a license to drive legally on the roads.

Attempts have been made to re-invent the death trap such as HHVM and PHP7 but its still the same old mess under i all - *does that method have an underscore in it again? Is it haystack needle or vice versa? Oh god - check the manual we may need to jumpstart it!

PHP will get you from A to B but its not as reliable or friendly as that Python and Ruby model that just hovered past.

If you are getting the following error when starting a new project on OSX especially the latest versions:
1
[curl] 7: Failed to connect to 192.241.224.13 port 80: Operation timed out [url] http://192.241.224.13/laravel-craft.zip

The simple answer is you are using an old version of Laravel's installer. As of writing this blog it is at version 1.3.1. Even if you have followed the install procedures given on the Laravel site you may still be suffering this issue.

Execute this command:

1
% where laravel

If the result is something like this /usr/local/bin/laravel instead of your local home directory being the first entry then I can guarantee you are running an older version which is overriding the versuin you have installed. Most likely version 1. BNext type this to confirm: laravel --version .

1
2
3
% laravel --version

Laravel Craft version 1.0.0

As you can see it seems on this machine version 1.0.0 is still the one being executed.

To solve the problem simply run % rm /usr/local/bin/laravel

Then redo the installation and make sure the new installation is pointed to in your .bashrc or .zshrc $PATH variable.

When you finally get the right version you should see something like this:

1
2
3
% laravel --version                                                                                                           

Laravel Installer version 1.3.1

Having been asked this question a few times by varying people I thought I’d do a quickie blog post on how to find subdomains for a domain.

# The Official Way

dig @ns.thenameserver.net example.com axfr AXFR is a method of domain transfer and if the name servers are configured to allow the command to be executed then it would give you the full NS record for that domain including any subdomains.

However, trying that will likely give you this message:

1
; <<>> DiG 9.8.3-P1 <<>> @ns.thenameserver.net example.com axfr; (1 server found);; global options: +cmd; Transfer failed.

# Unofficial Methods

If you're looking for a way to add configurable Deezer playlists to your Hexo blog then check out this helper.

This is my latest addition to the ecosystem: The Hexo Deezer Playlist Helper.

According to Hexo docs Helpers are:

used in templates to help you insert snippets quickly. Helpers cannot be used in source files.

So, they are good for adding widgets to your sidebar such as playlists, Twitter feeds, ad widgets, etc.
I'd already created a Hexo tag for showing a Deezer tracks but wanted to:

  1. Create a site widget that was more longterm.
  2. Create something other than a tag - as a new challenge and add something new to Hexo.

So it seemed only natural to create this plugin as a helper.

It would be pretty easy to convert into a tag and anyone is free to do that - check out the repo.

You can see the helper in action to the right -->

# Currently listening to...

You need to execute a single command across multiple servers? You may use Ansible but that’s mainly about playbooks, provisioning, setup and the like isn't it?

Not so.

Having been using Ansible for a couple of years I thought it about time I started using the ad-hoc commands.

In the past I used Fabric for executing SSH commands across multiple hosts but now Ansible fills that role nicely.

Below is a quick list of some Ansible one-liners:

# Update Your Apt Cache and Upgrade

  1. ansible main -i ./hosts -m apt -a "update_cache=yes upgrade=safe"

  2. ansible centosserver -i ./hosts -m yum -a 'name=* state=latest'

You’re not limited by OS with Ansible. Here I’m using both the Apt and Yum command modules to update all packages.

# Restart Your Webserver

  1. ansible 192.168.0.1 -m service -a 'name=nginx state=restarted'

  2. ansible main -i ./hosts -m service -a 'name=apache2 state=restarted'

  3. ansible webservers -m service -a "name=httpd state=started"

I’ve given 2 examples above to show:

  1. That you can reference a host directly on the terminal.
  2. It works for any service

# Deploy a Git Repo

ansible webservers -m git -a "repo=git://example.com/epicapp.git dest=/srv/epicapp version=HEAD”

If Knowledge is what you want
This will give you a JSON output of all your servers and a huge amount of information on each:
ansible all -m setup

The above assumes you have your hats file in the default location or defined somewhere.

  1. Official Ansible Docs
  2. Ansible Video Tutorial Series