Ensure /tmp/ is the start of a path before replace

We have an issue where '/tmp/' is in the target path, but is not the lowest directory (/usr/local/zend/tmp/). This folder is already the system temp folder... which is causing the path to become '/usr/local/zend/usr/local/zend/tmp/'