Auto-generate WordPress Secret Keys

In the file wp-config.php in your web-root folder, you should not forget to change your access keys/salts to something unique.

After install, WordPress generates this file, but the salt keys are not present yet.

Looks like:

define( ‘AUTH_KEY’, ‘put your unique phrase here’ );
define( ‘AUTH_KEY’, ‘put your unique phrase here’ );
define( ‘SECURE_AUTH_KEY’, ‘put your unique phrase here’ );
define( ‘LOGGED_IN_KEY’, ‘put your unique phrase here’ );
define( ‘NONCE_KEY’, ‘put your unique phrase here’ );
define( ‘AUTH_SALT’, ‘put your unique phrase here’ );
define( ‘SECURE_AUTH_SALT’, ‘put your unique phrase here’ );
define( ‘LOGGED_IN_SALT’, ‘put your unique phrase here’ );
define( ‘NONCE_SALT’, ‘put your unique phrase here’ );

There is a handy little site offer free hash generation and also auto-creates the WordPress variables so copy/paste is dead simple.

Here is the site:

https://md5.me/wordpress-secret-key-generator.php

Don’t share these keys with anyone you don’t trust!

Troubleshooting Composer and Zend Framework

While brushing up on my Composer commands, I had some trouble after running composer update, I found a nice troubleshooting list to check your setup/debug/troubleshoot:

https://getcomposer.org/doc/articles/troubleshooting.md

I have found that almost always (when working with Zend Framework 2.x – applies to ZF 1.x also) a problem with composer update is solved by step #4, clearing out the vendor folder and running the update command again.

Apple Announces New OS X Update 10.11, “El Capitan”

From WWDC this week:

“Apple’s next major release of OS X will be dubbed “El Capitan,” the company announced on Monday, featuring a number of tweaks and improvements, including enhancements to Spotlight, new gesture-based input methods for built-in apps, and more.”

Source: http://www.gospelpro.com/r/3gmoy

Use openssl for local web development

For Mac OS X (local dev built with homebrew)

Store the ssl cert somewhere:
brew install opensll
cd /usr/local/Cellar/nginx
sudo mkdir ssl
cd ssl

Create cert:
# Create a 2048 bit private key
# Change your -out filepath as needed
sudo openssl genrsa -out "example.local.key" 2048
 
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
 -keyout example.local.key \
 -out example.local.crt

NGINX example (zf2):
server {
 server_name dev.example.local;
 listen 443;
 root /www/dev.example.local/public;
 ssl on;
 ssl_certificate /usr/local/Cellar/nginx/1.6.2/ssl/local.crt;
 ssl_certificate_key /usr/local/Cellar/nginx/1.6.2/ssl/local.key; 

 the rest of your settings...
}

Make sure you domain is in hosts file (using TextMate from terminal):
sudo mate /etc/hosts

Host file changes:
127.0.0.1 dev.example.local

Stop/Start NGINX:
sudo nginx -s stop
sudo nginx

Source: https://serversforhackers.com/ssl-certs/

301 Redirect Problem with WordPress

Stumbled on this fix for a redirect issue I was having with a friend’s WordPress site:

Add this: remove_filter('template_redirect', 'redirect_canonical'); to the functions.php within your Active Theme folder.

You can find the functions.php file in: \wp-content\themes\{Your-Active-Theme-Name}

Source: http://www.violato.net/blog/php/88-wordpress-did-infinite-301-redirect-loop