Originally Posted by plecoking
No the horizontal 2x4 would be on it's side and the vertical would be placed on top so you have 6 inches to deal with.
Gotcha. A 2x4 is actually only 1.5x3.5 so a 4.5" screw would work for surface mounting. As others said, just drill a large bore hole 1/2 way though the edge of the bottom 2x4 and sink a couple screws in it.
FYI: A 2x4 on edge isn't very stable as it tends to "roll" no matter how many screws you use, unless your putting plywood or something on it, at which point the screws your fretting over are more place holders than structural support.