Skip to content

Subscribing doesn't work after switching to nginx

edited April 2013 in Troubleshooting

Hi,

Ok so I recently moved from an Apache server to Nginx server. First I had to convert the htaccess rules to nginx which I managed to do.
I can login ot the system, look at my lists and even loading previews etc works.

However I noticed subscribing to a mailing list doesn't work any more so I went to do some investigation.

Now the list id is: yk1RzQI4888dczahmkJqZYvA which is correct with what I get when checking subscribe form in the system.
Now I placed some echo's in the php code to see what is happening and found out on line 105 in subscribe.php things go wrong..

The sql that is done is:
SELECT login.language FROM lists, login WHERE lists.id = 9223372036854775807 AND login.app = lists.app

As you can see that list id is of course wrong.. the correct list id is a 2 digit number nothing that big

On a side note
You should rewrite this query as:
SELECT login.language FROM login LEFT JOIN lists ON lists.app = login.app WHERE lists.id = [nr]

and put an index on the column 'app'. This improve the join a lot, just check by using 'explain'.

All the best ,

Comments

  • Hi Steve,

    I am not familiar with nginx. Sendy works on Apache as mentioned on Sendy's website under FAQs.

    Any bugs with short.php for the new encryption and decryption method has been squashed when 1.1.5 was released based on users feedback.

    Ben

  • Well Nginx is a lot faster :).. however it would be weird if Nginx has anything to do with the way encryption works.. perhaps it is some standard module available in Apache which is not included in Nginx..

    Anyway you wanna help to get to the bottom of this to fix it it would only help your product. I'm asking because in your answer it feels like your saying well Sendy only supports Apache..

  • Hi Steve,

    openssl_encrypt and openssl_decrypt is used for list ID encryption. The encryption method is AES-256-CBC.

    Also, I noticed you said:

    Now I placed some echo's in the php code to see what is happening and found out on line 105 in subscribe.php things go wrong..

    The only code on line 105 in subscribe.php is }. Are you using version 1.1.5.4? If so please re-download the build from http://sendy.co/get-updated and re-upgrade your current installation as I suspect the current build you're using isn't a full and correct 1.1.5.4 build.

    Thanks.

    Ben

  • Hi Ben,

    I'm going to have a look at it right now..

    The line number inconsistency is because I added a few 'echo' lines I did a guess on the exact line based on the amount of echo's I added.. I'm probably off by a few lines. Will give you an update

  • ok I checked and openssl_decrypt is return false.. all data provided to the function is there though so must be something wrong with the function...

  • hmm its getting weirder..

    if (!extension_loaded('openssl')) {
    echo "
    open SSL extension not available...";
    }else{
    echo "
    Open ssl extension IS available...";
    }

    shows that openssl extension IS available on my server..

  • ok found the error finally.

    At some point the list ID's have changed??

    Because my list ID which I was using had
    '888' instead of '892'

    I checked my list id before but I must have missed this slight difference because of this the str_replace didn't do anything and thus the decryption failed..

    referring to line:
    $decrypted = str_replace('892', '/', $in);

    in short.php

  • Hi Steve,

    '888' was changed to '892' in 1.1.5.1 on Mar 1st (the first update after 1.1.5) to prevent conflicts in characters inside the encrypted IDs.

    Ben

This discussion has been closed.