How to install PHP Memcache on Windows WAMP, Linux for any operating system (without really installing)

I have a site that runs on Linux in production that uses Memcache. Installing Memcache on Linux is a cinch. I was setting this site up in my development environment however (Windows 7 64-bit, with WAMP, specifically Apache 2 and PHP 5.3) and I quickly discovered it’s not so easy. For the life of me, I could not find the correct php_memcache.dll file.

After spending a ton of time unsuccessfully install Memcache on my local machine, I realized that I don’t even need the memory caching functionality of Memcache, I just need the functions to work. Continue reading How to install PHP Memcache on Windows WAMP, Linux for any operating system (without really installing)

How to Install PHP APC on Fedora & CentOS

APC (or Alternate PHP Cache) is a popular PHP PECL extension that can be used for PHP op-code caching. It is very stable and can significantly reduce page rendering times. It works by caching the PHP binaries, so that PHP doesn’t have to compile them on every request.

Installation is simple:

1. Use yum to install necessary packages.

# yum install php-pear php-devel httpd-devel pcre-devel

Continue reading How to Install PHP APC on Fedora & CentOS

How to insert a tab character into Putty for Linux

If you’re like me, you’ve noticed that if you’re trying to grep for a tab character, the following won’t work:

grep "\t" file.txt

The solution is to use a literal tab character, but it’s not quite so simple. You can’t insert a tab character just by hitting the tab button or by pasting one in. You need to hit Ctrl+V first:

So to type a tab in the putty console:

How to have htop save configuration on exit

htop is awesome. I use it all the time to monitor all the servers I use. It was only until recently that I noticed it has some great configuration options, namely the "Tree View." This allows you to see a hierarchy of processes, which can be really helpful in finding out why certain processes are running.

I quickly realized it would be a pain to have to constantly hit F5 every time I opened the program, until I realized there was a way to make htop remember your last configuration.

What you want to do is make sure you close out of htop with F10 instead of Ctrl+C, which I normally use. You only need to use F10 when you want to save the settings, and can subsequently close out how you normally do!

How to Hide Digsby Ads

I use Digsby as my instant messenger client. A couple minutes ago, I received an update which set ads to display in the conversation windows by default. I immediately decided I'd try to figure out how to remove the ads, or switch back to Pidgin, the free open source client. Turns out it was simple to turn off the ads. When you're done, you'll need to reopen your conversation windows to see the changes.

From the Buddy List window:

  1. Tools -> Preferences
  2. Conversations
  3. Uncheck "Support Digsby development by showing an ad in the IM window"

How to Fix Linux SSH: Permission denied (publickey).

I just got done setting up a user in my new developer environment on multiple boxes. I made sure to copy over the authorized_keys file exactly, including the correct 0600 permissions, but kept getting the "Permission denied (publickey)" error when trying to ssh into one box, even though all the others worked.

What finally solved it for me was to make sure the user's password is set:

# passwd <user>

If that doesn't work, make sure the user's .ssh directory is chmod 0700 and the user's authorized_keys file is chmod 0600.

How to view where DNS has propagated all over the world

I just wanted to quickly share a nice tool that I use all of the time when transferring sites to different servers or just changing DNS entries. Sometimes it's hard to tell how long or if the DNS for your domain has updated in other regions in the world. In this case, I use WhatsMyDns.net. It's a neat tool that allows you to look up the current DNS listing for common entries (I really only ever need to use A or CNAME) in quite a few servers located around the world. Since DNS propagates differently by geographic region, this tool is a very good overview as to how users are accessing your site.

Also, if you're like me and constantly need to check your IP address and don't want to always search google for "whats is my ip", I'd recommend you bookmark whats my info, a simple, non-bloated site that gives you what just you're looking for.

How to Properly Test if jQuery is Loaded

I saw many people claiming you can test for the existence of jQuery like this:

if (jQuery) {
	// jQuery exists, put code here
} else {
	// jQuery not loaded, put code here
}

This is incorrect. It will work fine if jQuery is loaded, but if it's not loaded, javascript will throw an error and the code to execute if jQuery is not loaded will probably not be processed. The modification to fix this is simple:

if (window.jQuery) {
	// jQuery exists, put code here
} else {
	// jQuery not loaded, put code here
}