Linking the Drupal install to the php dir should be the last step in the build.

Guard against the deploy hook running if the build hook partially failed.