Dec 16 2011
Dec 16

I usually use linux, but for various reasons I've needed to use windows lately and so I figured I would setup Xdebug, Acquia Dev Desktop, and Netbeans in Windows.  I didn't see much for guides out there but its really pretty easy.

Step 1 - Install Acquia Dev Desktop:

You can install either the D6 or D7 one, because really they are the same and you can just add D6/7/yourflavor to it using its "import" button.

I installed this to "C:\acquia-drupal" and "C:\sites\acquia-drupal".  That way I don't have to worry about the spaces when configing my php.ini files.  Spaces in file directories always seem to cause me issues.  Like so:

Step 2 - Install Netbeans

I just went for the php version.  Once its installed you can download any plugins you want.

Step 3 - Setup Netbeans

This is pretty easy, I just basically followed: http://drupal.org/node/1019816.  Some of the options shown on that url are missing in my netbeans, so I just ignored them.

Also, install whatever plugins you want (git is a good one) from W.  To do this I had to run netbeans as administrator (in windows 7), everytime after that I didnt, but to get it going the first time I had too.

Step 4 - Add your project and config it for debug

The Drupal.org link above shows you how to add a project.  One tweak I would do after you add the project, right click your project > properties > Run configuration > Advanced > Do not open webbrowser.

Step 5 - Setup PHP for xdebug.

I noticed Acquia Dev Desktop had the xdebug extension already in the "C:\acquia-drupal\php5_2\ext" folder so I didn't even have to download it.

All I did was edit my php.ini file.  I added this to the bottom:

[debug]
zend_extension_ts=C:\acquia-drupal\php5_2\ext\php_xdebug-2.1.2-5.2-vc6.dll;
xdebug.remote_autostart=off
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

You can find a link to your php.ini file opening your Acquia Dev Desktop Control Panel and clicking on Settings, then config tab, then the "edit" button next to the php.ini file.

After you add the above to the php.ini file, stop and start the Acquia Drupal Stack.  Now, go back into setting, config tab, and click the phpinfo link.  This will open a page where you can see if xdebug is setup and working.  If you see anything about xdebug on that page, its probably working.

Step 6 - Install the easy Xdebug plugin for FireFox

This will put 2 little icons in your lower right of firefox, a bug-looking-thing and a green square.

Step 7 - Setup Breakpoints and debug

Boot up Netbeans, Acquia Drupal Stack, and Firefox. 

In firefox, go to the php page you want to debug. 

In netbeans, add breakpoints to where you want to stop.  Then click to the debug button in netbeans:

In firefox, click the green bug (lower right from easy Xdebug) and reload the page.

TADAAA, Netbeans will stop at the breakpoints and show you variables and such.  Very cool.

Conclusion

So there you go.  Pretty quick and easy to get up and running.  If you have any questions just let me know.  I'm not a pro at this stuff but I'll sure try and answer whatever you throw at me.

Jun 23 2011
Jun 23

Thu, 06/23/2011 - 16:11

I'm always moving sites from a "dev" url to the production url using Aegir.  Something like dev.mysite.com will become mysite.com.

In doing this, drupal has image issues, but its easy to fix.  You just have to do a search and replace in your database for the urls of your multi-site install.

I usually do something like:

UPDATE node_revisions set body = replace (body, 'sites/dev.mysite.com/files', 'sites/mysite.com/files');
UPDATE files set filepath = replace (filepath, "sites/dev.mysite.com/files", "sites/mysite.com/files");
UPDATE variable set value= replace (value, 'sites/dev.mysite.com/files', 'sites/mysite.com/files');
UPDATE boxes set body = replace (body, 'sites/dev.mysite.com/files', 'sites/mysite.com/files');

I usually do this in phpmyadmin and it fixes everything up just fine.

Just remember to double check everything (backslashes, files not file, sites not sites, etc...) and make a database backup before you do this.

Apr 08 2011
Apr 08

Fri, 04/08/2011 - 12:40

I've started using Amazon EC2 with Aegir's multiple server setup and its sweeeet.  I can add a new server to my Aegir setup in like 2 minutes.

My bash script

I've tested this script with ami-3e02f257.   These are its specs:

  • Ubuntu 10.04
  • 32bit
  • EBS Store (allows this to be "micro" compatable and easy to backup/clone.)

I don't see why the script wouldn't work with x64... I just didn't test that.

What it does

You can read through the script and see all the commads that it does but here is a quick summary:

  • Runs apt-get update and upgrade
  • Installs everything you need plus git and nano
  • Forces php to be 5.2 rather than 5.3 using approach #3 here.
  • Does almost everything you need to do in the manual aegir install for using the server as an slave host.  Sets memory limits, comments bind-address, creates aegir user, creates aegir_root mysql user, etc...
  • Installs pecl uploadprogress
  • Installs Drush

What it doesn't do

It DOES NOT configure your hosts file or your rc.local file.  You need to do both to get a FQDN (fully qualified domain name).

I add my ip (you will need an Elastic IP set in AWS console for your server instance) and domain name to /etc/hosts like so:

127.0.0.1 localhost
50.17.186.31 aegirslave1.mydomain.com aegirslave1 #line I added


# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

You also want to add a hostname aegirslave1.mydomain.com      to your /etc/rc.local right before the exit 0.

Logging into your slave from your master

You need to copy your ssh key from your aegir master to your slave.  I do that like so:

  • Copy the amazon key (example: yourkeyname.pem) to your master server however you wish, via ssh or ftp.
  • SSH into your to your master aegir server.... copy the id_rsa.pub file to your AMI instance:
    • scp -i /path/to/amikey/yourkeyname.pem /path/to/aegirserverkey/id_rsa.pub [email protected]:~/
  • Back at your ami instance terminal:
    • sudo chown aegir:aegir id_rsa.pub
    • sudo cp id_rsa.pub /var/aegir/.ssh/authorized_keys
  • Back at your master server, test the login:
  • ssh [email protected]

Finished and Future 2 Minute Installs...

Reboot and your done. 

Now before you go and add this to your "main" aegir install (in the web ui).  You should use Amazon AWS Console to clone your setup server:

  • Right click on yoru console and click the "Create Image (EBS AMI)"

  • Whenever you want a new server, you can create a new instance with that AMI... one that:
    • already has everything you need installed
    • has your aegir master ssh key (so you can instantly login to it)
    • only needs the hosts and rc.local file re-setup for you new IP and FQDN

Last Quick Tip

Use drush make files for your platforms.  That way, after you setup your newest Aegir slave host, you can put an Aegir platform on it AND add sites to it without touching the console again.  You can do it straight from the web UI. 

Here is a platform I have.  It uses a make file I have located at: /var/aegir/gitdev/build/stsbase/stsbase.make in my MASTER server.  I fill out the fields.. Aegir does the work :).

My notes from testing

I stuck my notes on pastebin, just so I have something to look back on.  They are basically a bunch of commands I always forget and how to do stuff I always forget how to do :). 

Apr 02 2011
Apr 02

Sat, 04/02/2011 - 14:25

Update 1 - April 5th 2011:  I modified some user creation items, they were completely wack.

Yesterday I updated my main aegir site to 1.0-RC3 and about 10 minutes after I was done I got my monthly bill from Linode.  I had forgotten how big its grown.  I've been adding more and more sites to my server and needed more memory and hard drive space.  Linode makes it sooo stink'n easy to add on more stuff that its grown to the point that I should probably be doing something different.

I decided it was time to take a look at Amazon EC2.  Now I don't have time to do a full tutorial on how to install aegir on EC2 but here are my notes:

Setting up the EC2 instance

  • Start here: https://help.ubuntu.com/community/EC2StartersGuide
  • Amazon AWS: http://aws.amazon.com - create an instance with the ami found at the link above.
    • Be sure to create a key pair, download the key and don't lose it.
  • Get your x.509 cert keys by going to:
    • http://aws.amazon.com/account/
    • then click on security credentials
    • there is a tab about half way down to download it.
    • you will get 2 keys a pk-XXXXXX.pem and cert-XXXXXX.pem
  • Back to ec2startsguide.
    • I only did step 1 - 4 on "Installing the API tools"since I already had my key's
    • NOTE: the "Installing the API tools" section is for your local computer, if your running ubuntu (I am...well linux mint anyways).
    • I skipped to 3 and 4 of "Using the Ubuntu Images" to login with ssh to my instance.
    • NOTE: you can get your "<external-host-name>" by clicking on your instance in the AWS console.  It will show down below where all the info shows.

Installing AEGIR

  • I followed the manual install here: http://community.aegirproject.org/installing/manual
  • You will have to use "sudo" in front of most of your commands to run them as root.
    • example: sudo apt-get install apache2 php5 php5-cli php5-gd php5-mysql postfix sudo rsync git-core unzip
  • At "3.2. DNS configuration" I could NOT get the stupid FQDN (fully qualified domain name) to stay after a reboot of the instance. 
    • I found this: http://www.lazytweet.com/post/6687864275
    • basically edit /etc/rc.local so that it says "hostname aegir.mydomain.com" (no quotes) before the exit 0.
    • Also you will need to edit your /etc/hosts file like normal
  • At "5.3. Running hostmaster-install" I had issues running hostmaster-install... I got the error "Dummy connection failed to fail".  I figured out I had to remove the anonymous users from mysql for some reason (I saw someone talk about it on drupal some place).  To do that I:
    • Added another user that I could login to webmin with (did I mension I installed webmin... its easy): 
      • Create the use and home directory: sudo useradd -d /home/myusername -m myusername
      • Set users password: sudo passwd myusername
      • add to sudo:  visudo
      • add this to the bottom of visudoers: myusername ALL=(ALL) ALL
    • Then I logined to webmin and enabled the mysql module
    • Then deleted the 2 anonymous users.I must have had my hostfile set funny because it created 2 servers: aegir.mydomain.com and localhost.
  • Lastly,  I must have had something funkey in my /etc/hosts file.  It showed "localhost" as a server having mysql only and aegir.mydomain.com as another server having onlyapache.  I set aegir.mydomain.com to have both server and mysql, verified it... then deleted localhost server.

Sorry its such a quick writeup but I hope it helps you out.

Jul 16 2010
Jul 16

Fri, 07/16/2010 - 12:32

A common question (I even thought of this when I first started using drupal after joomla)... Where did my content go after I created it?  So check out my video below:

Jul 16 2010
Jul 16

Fri, 07/16/2010 - 12:28

I'm about ready to roll out a new drupal distrobution aimed at the internet marketing world, but there is a problem.  Most of the IM community only know wordpress.  Wordpress is great... if I wanted just a blog, but I want more.  I want an internet marketing platform.

So, I need some educational videos, and here is the first one (don't forget fullscreen HD):

Feb 14 2010
Feb 14

Since the release of Aegir 0.3 I've been using Drupals multisite configuration like crazy.  Mainly because Aegir uses it but also because it just makes sense.  Starting a site in multisite works great, but moving an existing site to multisite configuration can cause some problems.

For example, on a regular Drupal install the images and file uploads are stored in the "sites/default/files" directory.  On a multisite install, the files/images are stored in "sites/example.com/files" directory.  This causes a problem becuase the links to most images/files that are in content will point to the wrong location:

So you'll get a site that looks like so:

If I only have 4 images on the whole site thats not really a big deal but if I have hundreds of images in hundreds of nodes I don't really want to fix each one individually.

Using Search and Replace in phpMyAdmin to Quickly Fix Links

The command for mysql that allows you to a search and replace is pretty simple:

update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]')

This isnt completely dumby proof as you need to know what table and field name you want to search/replace.

Most of my images are in the node body and are stored in the table "node_revisions" in the field "body".  I am going to replace anytime there is a "sites/default/files" with "sites/example.com/files".

UPDATE node_revisions set body = replace (body, 'sites/default/files', 'sites/example.com/files');

Simple enough.  I also want to change where the main file system is set at:

UPDATE files set filepath = replace (filepath, "sites/default/files", "sites/example.com/files");

I can run both of these at the same time.  I first go to my database

Then click the sql tab and run the command in it:

Thats it for the basics.  You may need to do other tables besides these 2 depending on what else you've got going on, but this should help you out.

Imagecache Issues

To fix this, I had to do something like so:

WARNING, I have not tested this code on D5 (all the above I tested on D6).  But should be similar on D5

UPDATE files set filepath = replace (filepath, 'sites/old.example.com/file/', 'sites/new.example.com/file/');

I had to remove all the sites/example.com/file/ (dont forget the end slash on this one) from all the links.

Test this first

Always do this on a test site first and have backups.  Dont just start going around search replacing on your sites.  That = bad.

Other things to think about

  • site logo
  • images in comments
  • images in things other than comments and nodes

Am I missing anything?

Feb 11 2010
Feb 11

The nodewords module allows you easily set the meta tags on your site.  Some features of this module are (quoted directly out of the documentation):

  • The current supported meta tags are ABSTRACT, CANONICAL, COPYRIGHT, GEO.POSITION, DESCRIPTION, ICBM, KEYWORDS, PICS-LABEL, REVISIT-AFTER, ROBOTS and the site verification meta tags used by Google Webmaster Tools, Microsoft Bing Webmaster Center, Yahoo! Site Explorer.
  • You can tell "nodewords" to add all terms of some specified vocabularies to the KEYWORDS meta tag.
  • You can specify a default meta tag ROBOTS value to use for all pages. You can override it on each page.
  • On taxonomy pages, the term description is used as the DESCRIPTION tag. The term itself is added to the list of KEYWORDS. You can override the description to use if you wish.
  • You can seperately specify the meta tags to show on some specific pages of your site (in example, the front page, the error 403 page, the error 404 page, the tracker page), or to use in specific situations (in example, when the site is offline).
  • The support for Views, and Panels has been removed from Nodewords 6.x-1.x on August 15, 2009; successive versions for Drupal 6 replaced it with a more generic support for third-party module pages.
  • You can select which of these tags you want to output on each page. You can also remove the edit box for these tags from the node edit page if you don't like using it.
  • All text of the DESCRIPTION and KEYWORDS meta tags are added to the search system so they are searchable too; other meta tags could be added to the search system too (depending on the code implemented from the module).

So basically, nodewords does a lot of stuff, most of which you may not ever use (i know I don't use a lot of it), but its nice to know the functionality is there just in case you start using it.

How I use it

Many of different meta tags out there are often ignored or influence your SERP rankings very little.  As such I don't worry about most of them.  On every page I use mainly KEYWORDS and DESCRIPTION.

I spend maybe 10 seconds on the keywords tag and spend a good amount of time on the description meta tag (if I remember to do it).  I will also do a robots = noindex for pages that are used as thank you pages for newsletter sign-ups or just pages that I really dont want/need on the search engines.  Other than that, I really dont use much else... maybe canonical url tags but I try to setup drupal so I don't have a lot of duplicate content to worry about.

The Keywords tag - These don't really have much pull any more since they can be abused so easily.  They are also easy for the competition to very simply check what you have in the tag.  I used it because I believe it is still considered by search engines but I don't put in my exact keywords I might be trying to target.  If I'm targeting "dog training for fat dogs" I would put in "fat, dog, training"... something like that.

The Description tag - This is very important.  Maybe not so much for SEO (search engines still consider it though) but for selling your link.  If you have a 2nd or 3rd place spot for a search term, but your description is just a bunch random of text automatically pulled from the page ... you're going to loose clicks.  Keep this less than about 150 characters

The description tag should contain the keywords your trying to target, but feel like a normal description of your content.  It should try to pull in people from the SERPs.

The Google Webmaster Tools verification code

This is used with, yep, you guessed it, google webmaster tools (shocker hu...).  I only add my verification code to the front page.  Seems kinda silly to be able to add the code to every page... but whatever.

Settings Tab

Other than that, I only other things I have set are:

Maximum meta tags length: *

With those settings, you should get a collapsable meta tags settings for each node on your site.  That way you can set each and every node (wooohoo.. that will be fun if you have several thousand nodes to do).

Default and Specific Meta Tags Tab

Under this tab, I basically only set the frontpage meta tags and meta tags for any views I have (via "other pages").

I do not use the "Default Values" as I want everything to be different, and this also forces me to do it right and fill it out.

There you have it.  Nodewords does a pretty good job and makes it easy to add meta tags to each page.  It is a vital tool for doing SEO with drupal.

Feb 10 2010
Feb 10

Wed, 02/10/2010 - 12:35

Aegir .4 Alpha 5 Came out last week and so I thought i would do a quick video for those VPS newbies out.  Aegir really is sweet and if you are wanting to ever just test it, this is a good starting point for you.

This can be done w/ almost any linux VPS host.  I chose to go with Burstnet for the screencast because they got decent reviews from web hosting forums and is DIRT cheap.

I would recommend Linode if you are looking for a good VPS host.  I have a node w/ them and they have always been wonderful.  Don't take my word for it, they have hundreds of reviews all over the web bragging them up.

So don't be scared... jump right in.

Part 1:

Part 2:

Here are my slides w/ links for the video:

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web