Page 1 of 1

Emails not working after upgrading to PHP 5.4

Posted: Tue Aug 22, 2017 3:51 am
by jmagro
Hi there. We operate 4 opencart websites (all working perfectly as of last Thursday 8/17). I was getting started on upgrading some outdated versions (1.5.6.4 on highbondtapes.com) so I took the first step and updated our version of PHP. I've made no other changes yet and all of a sudden the email confirmation, order confirmation, and all other web emails stopped sending. I contacted our hosting provider and they seemed to think it was the code. I'm not convinced ...

They were able to generate this error: [Mon Aug 21 15:30:52 2017] [error] [client 216.54.31.82] sh: -t: command not found, referer: http://highbondtapes.com/index.php?rout ... on/contact

I couldn't even begin to interpret what that means ... any ideas? Thanks in advance.

Re: Emails not working after upgrading to PHP 5.4

Posted: Tue Aug 22, 2017 8:00 am
by IP_CAM
you may find some answer on this here:
https://www.google.com/search?q=+"sh%3A ... not+found"

Re: Emails not working after upgrading to PHP 5.4

Posted: Tue Aug 22, 2017 10:44 pm
by MrPhil
jmagro wrote:
Tue Aug 22, 2017 3:51 am
They were able to generate this error: [Mon Aug 21 15:30:52 2017] [error] [client 216.54.31.82] sh: -t: command not found, referer: http://highbondtapes.com/index.php?rout ... on/contact

I couldn't even begin to interpret what that means ... any ideas? Thanks in advance.
Well, it sounds like something in your store is passing -t to the system ("shell") as a command. There is no -t command; it sounds like a flag for a command, but the command name itself is missing (e.g., "mail -t to_address" is given as "-t to_address", or something like that). A quick look at my 2.3 code doesn't show a -t flag, so maybe that's something on an earlier OC version.

Maybe your host removed a "mail" or "send" command, or changed something else pertaining to mailing (or restricted it in some way). If you haven't already, you might ask what the mail command differences are between the old and new PHP versions (and any server or OS upgrades involved). I think there are some differences in PHP mail, although I can't tell you for sure what kind of command your store is trying to pass to the system (it might be from an extension you've installed). Anyway, the first thing is to search your code for -t and see if there is a system() call or something similar using that string. Find out what command it's trying to pass to the operating system, and check whether OC itself made the command disappear, or your host is now filtering it out as a security issue or something.

P.S. PHP 5.4 is still obsolete. I hope this is just the first step in a planned move up to at least 5.6, if not 7.0.

Re: Emails not working after upgrading to PHP 5.4

Posted: Tue Aug 22, 2017 10:57 pm
by jmagro
Oh wow, I wonder why they wouldn't automatically update something like that. I will see what I can find out. Thank you so much for explaining that. As far as searching my code for the -t ... is there a specific file I should search for that?

Re: Emails not working after upgrading to PHP 5.4

Posted: Wed Aug 23, 2017 3:02 am
by MrPhil
Unfortunately, I have no idea what file this -t flag might be found in. You shouldn't be searching individual files by hand -- make sure you know how to use a tool such as grep (Linux) or findstr (Windows) to search all files in all directories at once.