New Relic is a great service for monitoring servers and website applications. One of the major features is New Relic’s PHP application monitoring and the ability to do per directory PHP monitoring. This is useful for web servers that run PHP but serve multiple PHP applications under different domain names/directories. Being able to create per directory PHP application monitoring allows you to get more meaningful data about a specific PHP app and gives you the ability to segment your app data easily. I’ll show you how you can automate this type of setup with an Apache setup which is controlled by DirectAdmin.
Recently I was checking out the YouTube API docs, specifically the public iframe JavaScript API. Sometimes the generic iframe embed codes aren’t enough and hence we have lovely API’s that developers can go to town on. While I was experimenting with the YouTube API I came across an interesting visual issue that kept occurring when defining width and height sizes. Random black borders, was this letter-boxing or something else?
(more…)
SSL should be something everyone should be aware of on the internet. Even if you don’t know what it stands for (Secure Socket Layer by the way), everyone should at least recognise the basic icons like the green padlock or general padlock icon. You’ll often find it on online banking/e-commerce websites, your browser will be letting you know the website is genuine and your OK to punch your lovely personal details into it. Well WordPress has a dashboard and login system, which can go over SSL. Here’s a quick way of making that happen.
This guide assumes you have a valid SSL certificate already setup
In your wp-config.php file find the comment line:
/* That's all, stop editing! Happy blogging. */
Immediately before that line add the following:
/** * SSL for Login and Admin */ define('FORCE_SSL_ADMIN', true);
This will then force SSL on the dashboard and logins! You’ll find general port 80 requests to /wp-admin and /wp-login.php will get redirected automatically. Much more secure than your password going across in plain text. Because you know the NSA and PRISM probably have your connection to your ISP tapped… Woops probably said too much.
WordPress is a very database centric Content Management System, and like most systems the SQL database can be the best way to achieve a quick solution to an otherwise long and boring repetitive task. Here’s one of those tasks. I needed remove all the old thumbnails, due to bad sizing and thumbnail improvements. However I have over 100 posts, so I’ll be damned if I’m going to manually go through the WP dashboard and do it. Here’s a quick and easy way to kill all the thumbnails quickly via SQL
DELETE FROM wp_postmeta WHERE meta_key = '_thumbnail_id'
This will remove all thumbnail references on all posts and has_post_thumbnail() will return false.
If you needed to run this on a specific set of rows, you’d need to use an AND clause at the end of the above SQL
Note: Always run SQL commands like this on a testing server/localhost installation and have backups ready!
So recently I’ve relaunched my blog, with that came A LOT of offline time (busy with irl etc etc). I develop various projects on localhost environments but one thing that doesn’t play nice with localhost is Disqus comments. This is because it requires a live top level domain with the correct permalinks to each post (or discussion in this case), so of course while my blog was under development this got quite badly out of sync and started to slowly break. Putting my blog back online and chaos ensued on the comments front, its getting back to normal now, but I had quite an adventure solving some interesting quirks.