Shift Register LCD Not Working With Arduino Mega 2560

I have a basic 16x2 LCD hooked up with a 74HC595 shift register. However, I can only make it work with the Arduino Uno, and I need it to work on a Mega 2560.

The library I used is here: Arduino Playground - LiquidCrystal Library

I have it hooked up the same way as the image shown in the above link.

This is the code I am using:

#include <SPI.h>
#include <LiquidCrystal.h>

LiquidCrystal LCD(9);

void setup() {
  LCD.begin(16, 2);
  LCD.print("hello, world!");
}

void loop() {
  LCD.setCursor(0, 1);
  LCD.print(millis()/1000);
}