Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Email Piping not working.

I am trying to set up osTicket on our servers as a replacement for our current system. However i have tried just about everything and I cannot get piping to work, I always get a bounce back with "local delivery failed"

The server is a hostgator dedicated linux server running CentOS
Here is a bunch of info on my current versions:
php v5.5.10
MySQL v5.5.36
osTicket(Just re-downloaded today) v1.8.1.2

The only error logs I get when I try to send an email are like the following:
[02-Apr-2014 16:20:34 UTC] PHP Fatal error:  Call to a member function stripQuotedReply() on a non-object in /home/domain/public_html/osticket/include/class.mailer.php on line 160

My forwarder was set up as instructed in the wiki in cPanel email forwarder. The email was "support@domain.com" to the following path:
public_html/osticket/api/pipe.php

I have tried just about everything and i have been searching related problems for the past day or so. Here are some things i have done:
made sure permissions on the pipe.php file were set to 0755
checked the line ending characters were fine, even ran dos2linux comand and retyped the hashbang line
Tried multiple different shebang lines. All of these have the same php version of 5.5.10 when tested in a cli with a simple -v including:
  • #!/usr/bin/php -q
  • #!/usr/local/bin/php -q
  • #!/usr/local/php5/bin/php5 -q
  • #!/usr/local/bin/php -q

I even tried doing the following command in a cli prompt as suggested and another thread, with what i think to be a mail file on our server (i changed the numbers in the file name and changed the domains in the obvious places below)

 php /home/domain/public_html/osticket/api/pipe.php < /home/domain/mail/maildomain.org/support/cur/15645613.anotherdomain.com,S=5162:2,S

i tried the same things with a "test.txt" file and I get no results anywhere.

In ALL cases no ticket gets input into the system. I made sure to have a department email associated to this forwarded email as well.

Any suggestions would be nice. Until then i will be attempting to set up IMAP fetching.

Comments

  • Last I checked Hostgator only uses PHP5.3+ if you tell them to.
    (via .htaccess, or in your case by pointing the cron.php to it on the first line).
    I would bet that its /usr/bin/php54/bin/php5 bnut you would have to check with HostGator support to be sure.

    I think that you can go into your hostgator control panel and click on PHP configuration and change the PHP system default also.
  • Right, we had to put a ticket in to hostgator for them to upgrade our php to v5.5 for osTicket to even function. We were previously on v5.2.

    Either way, like i said, i checked the versions of php used in the hashbang line, and all say 5.5.10, (except #!/usr/local/php5/bin/php5 -q, that one didn't work)
  • so, also trying to set up IMAP fetching, No results with that either, but the same errors in the log of:
    [02-Apr-2014 19:08:33 UTC] PHP Fatal error:  Call to a member function stripQuotedReply() on a non-object in /home/domain/public_html/osticket/include/class.mailer.php on line 160

    and occaisionally this on as well:
    [01-Apr-2014 19:53:10 UTC] PHP Strict Standards:  Non-static method osTicket::is_cli() should not be called statically in /home/domain/public_html/osTicket/include/class.osticket.php on line 406,
    but not sure if thats relevant, it might be due to something i was doing before, it was yesterday that the last one showed up.

    Just set up a cron in cpanel to run every 5 minutes, set up the email in osTicket with the login and all the connection information to point to cron in that same api folder.

    Also, when I run cron.php in the api folder nothing happens.
  • edited April 2014
    Welp. So i figured it out, and i feel like the reason should be mentioned somewhere, but it could just be my own inexperience.

    turns out, it was all because my folder was named "osTicket", which it was since the initial install. I changed it to "osticket" and it seems to work. This little bit of case pickyness was not mentioned in any documentation, so i would appreciate if this gets fixed.

    Also forgot to mention, in my previous posts, all the paths i have in my system HAVE the capital T, so it wasn't that. I just changed them in these posts to attempt to keep consistancy with what others are saying.
  • Hosts like Hostgator routinely have more than one version of PHP installed. Setting up an .htaccess to make sure web requests utilize one version does not mean that the CLI version will also use that version. The CLI version is often the first version that was installed.  To by pass this you need to use the full path to PHP 5.3+.

    Personally my path on my hostgator account is /home/USERNAME/public_html/DOMAIN/osticket.

    Once your sure you have the right version of PHP running your PHP error logs should have an error in them as to why it didn't work.  Is it the same error thta you listed before?
  • edited April 2014
    So, I lied, that folder re-name ONLY seemed to have fixed email fetching, not piping, and that is because i was stupid and put the wrong path in my cron schedualer, so IMAP fetching works, but piping stlll doesn't

    And yes, the same error keeps popping up, and this time the folder actually does have a lower case t, as opposed to me changing it to that from the upper case. I am talking about this:
    [02-Apr-2014 19:08:33 UTC] PHP Fatal error:  Call to a member function stripQuotedReply() on a non-object in /home/domain/public_html/osticket/include/class.mailer.php on line 160
  • scratch that, i lied. My cron schedualer still has the uppercase and yet it works when the folder is lower case.
    Hm. Well, piping still doesn't work.
    Also i am not sure i understand your comments about versions in cli, I already said i tested the cli php version, and it is 5.5.10. I understand there is often multiple versions on hostgator server, but i have also tried the paths suggested by other hostgator users.
  • Update for this situation:

    Still couldn't get pipe to work, and now my cron does not work. In fact i am not sure how it ever worked. Every time my cron runs (every 5 minutes) I still get the error:
    [03-Apr-2014 12:30:02 UTC] PHP Fatal error:  Call to a member function stripQuotedReply() on a non-object in /home/MYUSER/public_html/osticket/include/class.mailer.php on line 160
    And the same thing happens ever time I try to run the pipe with the mail forwarder.
    Does anyone know that that error actually means? I clanged into the code and it seems like its trying to call this function on the cfg object, so does that means the config was not read correctly? I check my file permissions and it it has read and execute for everyone, group, and user set.

    Also, other things I have tried:
    I tried renaming my database for osTicket to all lowercase as well as change my config file database line to have the same lowercase name, and no results. I tried defining the root path in that config file as well, as if it would help. Not sure what to do now. Could use some help. I am going to try to at least get it to the point where it was functioning with email IMAP fetching.
  • Last update before I can do nothing but wait for a reply:
    I found out what I did to get the emails to import. I was periodically trying to run the cron from a cli, so once I did with the changed folder name, It rand correctly and imported the scripts.

    So, the cron only runs when executed in a cli. I suppose this means i will have to investigate why it is not running correctly when run as a cron. I suspect i might be able to get fetching to work, but i would much prefer an email pipe, but that doesn't even function in cli
  • I'm still not convinced that yout CLI is the right version of PHP.

    Can you setup a cron that does a phpinfo(); and dumps it to a file?  That ought to clarify one way or the other.  OR maybe a "php -v > text.txt".

    Either way I've asked the devs to take a look at this thread.
  • did the php -v > text in a cron:
    PHP 5.5.10 (cgi-fcgi) (built: Mar 31 2014 18:14:16)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

    like I had mentioned. I have been working on this for a while now, and after speaking with some people, they seem perplexed that this cron seems to be running as apache, becuase when i rememove the line to prevent an email at the end of the cron ">/dev/null 2>&1" The email that was receieved was a 500 error.
  • Okay that convinces me its not a PHP issue.  I've re-pinged the devs to take a look at this.
  • So after working with a couple other people, we have discovered both a solution and a minor flaw in the code:

    Turns out there is no real debug statements for CLI in the current code. A coworker added the following in bootstrap.php at line 266 to fix this:
    if(osTicket::is_cli())
    {
          error_log($msg);
    }
    resulting in the following function:
        function croak($message) {
            $msg = $message."\n\n".THISPAGE;
            if(osTicket::is_cli())
            {
                error_log($msg);
            }
            Mailer::sendmail(ADMIN_EMAIL, 'osTicket Fatal Error', $msg,
                sprintf('"osTicket Alerts"<%s>', ADMIN_EMAIL));
            //Display generic error to the user
            Http::response(500, "<b>Fatal Error:</b> Contact system administrator.");
        }
    
    After adding this, you get more significant error logs, and these let us to our problem. It had the error:
    [04-Apr-2014 13:21:16 UTC] Unable to connect to the database -Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    along with the previously mentioned error.

    With a little more digging it was found that it was trying to connect to mysql using the direct ip for that user/domain on our server. The solution was to allow MySQL connections from that ip, and to change the DBHOST in the ost-config file to either the direct ip or "127.0.0.1" instead of what we had, which was "localhost". It may still work with "localhost" but we had not tried that after adding the mysql connection.

    This is an issue that is likely to come up for a lot of other cPanel/hostgator users, so it might be worth looking into or documenting.
Sign In or Register to comment.