Patch phpsh to make it usable

Closes #966