use getcwd() instead of exec('pwd')

Allows this to work then the pwd command isn't on the local system