What PHP default_timezone_set based on? - datetime

I want to use the same time on master and slave.
I did that and has problem about date not return the same:
Server #1:
date_default_timezone_set('America/Los_Angeles');
date('r'); // => Thu, 17 Nov 2011 09:16:11 -0800
Server #2:
date_default_timezone_set('America/Los_Angeles');
date('r'); // => Thu, 17 Nov 2011 08:40:21 -0800
Server #3:
date_default_timezone_set('America/Los_Angeles');
date('r'); // => Thu, 17 Nov 2011 02:24:30 -0800
Any reason date('r') not return the same value on all server with same timezone set?
Thanks for your answer.

maybe the time is simple set wrong on the system. you could try to use a timeserver to fetch the date if you dont have enough rights.

Related

AWS API Gateway and DynamoDb Serialization Exception Response Codes

This question resolves how to fix serializaion errors caused by a bad template, but if they are cause by input errors like a missing param, they are returned with a 200.
I'm trying to add a response template for errors using the CDK on an DynamoDb integration
read_integration_responses=[aws_apigateway.IntegrationResponse(
status_code="200",
response_templates= {"application/json":read_response_template}),
aws_apigateway.IntegrationResponse(status_code="400",
response_templates={"text/html": "Client Error"},
selection_pattern="400" )
])
The 200 works fine, but I get a 500 server error when I have an error. The logs are no help:
Fri Feb 10 21:37:37 UTC 2023 : Sending request to
https://dynamodb.us-east-1.amazonaws.com/?Action=Query Fri Feb 10
21:37:37 UTC 2023 : Received response. Status: 400, Integration
latency: 6 ms Fri Feb 10 21:37:37 UTC 2023 : Endpoint response
headers: {Server=Server, Date=Fri, 10 Feb 2023 21:37:37 GMT,
Content-Type=application/x-amz-json-1.0, Content-Length=60,
Connection=keep-alive,
x-amzn-RequestId=HB4E7S3FS0NIMM44OQRN6RPBEBVV4KQNSO5AEMVJF66Q9ASUAAJG,
x-amz-crc32=3948637019} Fri Feb 10 21:37:37 UTC 2023 : Endpoint
response body before transformations:
{"__type":"com.amazon.coral.service#SerializationException"} Fri Feb
10 21:37:37 UTC 2023 : Execution failed due to configuration error:
Output mapping refers to an invalid method response: 400 Fri Feb 10
21:37:37 UTC 2023 : Method completed with status: 500
Per the method documentation selection_pattern is a string that matches the response code.

Push for pass on Passbook

I try send push notification on Passbook by ApnsPHP library
$config['production'] = DOCROOT . '/my_cert.pm';
$config['entrust'] = DOCROOT . '/entrust_root_certification_authority_2048.pem';
$config['passphrase'] = '';
$token = $push_info->push_token;
$text = 'TEST';
$push = new ApnsPHP_Push(
ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION, $config['production']
);
if ($config['passphrase'] <> '') {
$push->setProviderCertificatePassphrase($config['passphrase']);
}
$push->setRootCertificationAuthority($config['entrust']);
$message = new ApnsPHP_Message();
$message->addRecipient($token);
$push->connect();
$message->setSound();
$message->setText($text);
$push->add($message);
$push->send();
$push->disconnect();
$aErrorQueue = $push->getErrors();
if (!empty($aErrorQueue)) {
echo 'Error - ' . print_r($aErrorQueue, true);
}
Output
Wed, 20 Mar 2019 11:01:16 +0000 ApnsPHP[6467]: INFO: Trying tls://gateway.push.apple.com:2195...
Wed, 20 Mar 2019 11:01:17 +0000 ApnsPHP[6467]: INFO: Connected to tls://gateway.push.apple.com:2195.
Wed, 20 Mar 2019 11:01:17 +0000 ApnsPHP[6467]: INFO: Sending messages queue, run #1: 1 message(s) left in queue.
Wed, 20 Mar 2019 11:01:17 +0000 ApnsPHP[6467]: STATUS: Sending message ID 1 [custom identifier: unset] (1/3): 87 bytes.
Wed, 20 Mar 2019 11:01:18 +0000 ApnsPHP[6467]: INFO: Disconnected.
But device didn't try push my server (all request write in log, he is empty).
I cant understand what wrong... some ideas?
The thing is that Apple has made a change in the export of certificates for signing. Now it has a simplified mechanic: the certificate bundle (pass cert and Apple certificate) is immediately exported to "*.pem"

Wordpress emails going to spam

I have been having a lot of issues with emails from our servers going to SPAM. I cant find out why, I am not on any blacklist and we have the SPF/DKIM records validated.
Below is a transcripts of our emails...
Received: from host.ilovenz.me (host.ilovenz.me [96.30.1.56])
by relay-6.us-west-2.relay-prod (Postfix) with ESMTPS id 34DBA460BBA
for <20g0dnL7Le4vW8#dkimvalidator.com>; Sun, 26 Feb 2017 03:31:39 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilovenz.me;
s=default; h=MIME-Version:Content-Transfer-Encoding:Content-Type:Date:
Subject:To:Sender:From:Reply-To:Message-ID:Cc:Content-ID:Content-Description:
Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
List-Post:List-Owner:List-Archive;
bh=dKce1b0OIqr1iFXsTI1PsQWwBft9eaJeSIwAbZhxRp0=; b=VOkfOW7ftU5bxGSL0Q9D+2tvB2
nGx9pmAcaRGzrFlwOLg8IrYYmU0h8PWqPTQ/4mD26BJCAEUdAYjXaKYl9ovhGWJMW9qAfK4Hy7JXk
aQDJOw6jBKHM5aRbgm9aIuXrPEe4+AngMao85vH9PKRTBQxegl2nJYX+JApr4MHf1S14uCyEYAcD7
nJwlrZJ32VAxn2gz1rDeevkTSptaSqpgX4EURzZDR/2osv53Np2//F+5qCTFabvwr9qe5RyiKsV5g
56TP/Ym1R4a25QzOg4yLiqr0ZlBh4zTB6lIGpfF7NWRtOPW49c02rEO8raOV3lgfXWWi+kD4NO1fy
Xw8Tljtw==;
Received: from host.ilovenz.me ([96.30.1.56]:48972 helo=localhost)
by host.ilovenz.me with esmtpa (Exim 4.88)
(envelope-from <hello#ilovenz.me>)
id 1chpYg-0000eR-6I
for 20g0dnL7Le4vW8#dkimvalidator.com; Sun, 26 Feb 2017 16:31:38 +1300
X-Mailer: Postman SMTP 1.7.2 for WordPress (https://wordpress.org/plugins/postman-smtp/)
From: ilovenz <hello#ilovenz.me>
Sender: hello#ilovenz.me
To: 20g0dnL7Le4vW8#dkimvalidator.com
Subject: [I Love New Zealand] Activate your account
Date: Sun, 26 Feb 2017 03:31:38 +0000
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
MIME-Version: 1.0
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - host.ilovenz.me
X-AntiAbuse: Original Domain - dkimvalidator.com
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - ilovenz.me
X-Get-Message-Sender-Via: host.ilovenz.me: authenticated_id: hello#ilovenz.me
X-Authenticated-Sender: host.ilovenz.me: hello#ilovenz.me
X-Source:
X-Source-Args:
X-Source-Dir:
Thanks for registering!=0A=0ATo complete the activation of your account,=
go to the following link: https://ilovenz.me/activate/kWwH8aMmTTYQCeii6=
nHDAZ1T3Lxw0QSr/
Probably because you are using an unusual TLD and you have the word 'love' in it. I had a similair problem with a poker site.

Automated emails from Woocommerce marked as spam. Wrong Return path

All the automated emails sent from woocommerce from my website are marked as spam. Here is the header:
Delivered-To: fontanavideostudios#gmail.com
Received: by 10.64.118.34 with SMTP id kj2csp1351282ieb;
Thu, 2 Apr 2015 05:19:26 -0700 (PDT)
X-Received: by 10.194.176.4 with SMTP id ce4mr94751409wjc.75.1427977166190;
Thu, 02 Apr 2015 05:19:26 -0700 (PDT)
Return-Path: <racebook>
Received: from ns362512.ip-91-121-174.eu ([2001:41d0:1:ef28::1])
by mx.google.com with ESMTP id e5si8490541wjw.70.2015.04.02.05.19.25
for <fontanavideostudios#gmail.com>;
Thu, 02 Apr 2015 05:19:26 -0700 (PDT)
Received-SPF: temperror (google.com: error in processing during lookup of racebook: DNS timeout) client-ip=2001:41d0:1:ef28::1;
Authentication-Results: mx.google.com;
spf=temperror (google.com: error in processing during lookup of racebook: DNS timeout) smtp.mail=racebook;
dkim=temperror (no key for signature) header.i=#
Received: by ns362512.ip-91-121-174.eu (Postfix, from userid 504)
id EA9BA1608B; Thu, 2 Apr 2015 14:16:42 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=racebooking.net;
s=default; t=1427977002;
bh=8Bpk5qKGS/snauZWTEWdgTP8RA8IIyUciiaTtpnN268=;
h=To:Subject:Date:From;
b=uPVvgt52HbS6VIzCMagUSpBDCvF787qIleF13Yw/7E95kuXdVJSdCo5IjbUTmGuBm
TUSe7jiDf4RfGzq2BQJUnFd91RljAVJHxWscY9U/ZFqGU65MjeIIfN7jLa+/k6Aj0/
m2bULvyRjwdU1EInjtl9y3SC593kACANJPR+u8/Y=
To: fontanavideostudios#gmail.com
Subject: Puoi scaricare i files accedendo a questa pagina: https://www.racebooking.net/foto-franciacorta/mio-account/
X-PHP-Originating-Script: 504:class-phpmailer.php
Date: Thu, 2 Apr 2015 12:16:42 +0000
From: Foto Franciacorta <noreply#racebooking.net>
Message-ID: <ddc1208f249c3ad34b96dad0437c49d8#www.racebooking.net>
X-Priority: 3
X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
The cause is probably that the Return-Path is wrong. Instead of noreply#racebooking.net (correct) it is racebook, (incorrect). How can i fix it? I couldn't find any setting into Woocommerce options to fix the Return Path.
I fixed that by using this plugin which simply copies the "from" email into the Return Path

iCal not parsed in gmail in one of two accounts

I'm trying to generate an email containing an iCal event from my application, I'm testing the email in two google accounts: one from gmail and one from google apps.
When I'm getting the event in gmail ([email1]#gmail.com) the event is rendered like this with no problem:
But when I get it in my google apps account ([email2]#[domain].com) it's not rendered, I don't know if it is being interpreted but it just dont show me the event, it only shows a simple email with an attachment (invite.ics)
This is the email message that is being generated:
Delivered-To: [email2]#[domain].com Received: by 10.205.80.15 with
SMTP id zs15csp100752bkb;
Thu, 7 Mar 2013 17:12:25 -0800 (PST) X-Received: by 10.236.126.202 with SMTP id b50mr351212yhi.25.1362705145168;
Thu, 07 Mar 2013 17:12:25 -0800 (PST) Return-Path: Received: from mail-gh0-f181.google.com
(mail-gh0-f181.google.com [209.85.160.181])
by mx.google.com with ESMTPS id f43si3539773yhk.290.2013.03.07.17.12.24
(version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
Thu, 07 Mar 2013 17:12:25 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.181 is neither permitted nor denied by best
guess record for domain of app#[domain].com)
client-ip=209.85.160.181; Authentication-Results: mx.google.com;
spf=neutral (google.com: 209.85.160.181 is neither permitted nor denied by best guess record for domain of app#[domain].com)
smtp.mail=app#[domain].com Received: by mail-gh0-f181.google.com
with SMTP id y8so186664ghb.26
for <[email2]#[domain].com>; Thu, 07 Mar 2013 17:12:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20120113;
h=x-received:message-id:mime-version:from:to:date:subject
:content-type:x-gm-message-state;
bh=WkTwznIOK5D42bFC8nOzJjgv3+K9EWlBJWKv1ejbN9w=;
b=n8BuYosOIOzxX28UkvX71UjVR9gFK00+9vixzoImOEvRKSvCimOPf1nvcpZR3AMShv
rl/0ahNmVoDJ0ypjTiqA/fRZazf2M65SWJih/MGJuYmhzpyTpf371Z8NI65sAAGMvB0w
KIaKl3kybyuS1TxysalZ/ZssN1vf2BT9T5Y5vVR+uAzBeAmtxZap733ZEn+Z+UvHQmOL
twu64kvR/6TSWLFZgrtkGdKC8Gcet4CGeXQd/qKg0ZjpFPNXmuDXeqIz6Ftouuu7fFhd
ms30c9l6zaexmpbFCCiZdtuwIfMKFjPuMnqtT6KcucDWmTTgu8LbBqNqdV5icFkrrCM2
LnTQ== X-Received: by 10.236.138.162 with SMTP id a22mr309438yhj.80.1362705144570;
Thu, 07 Mar 2013 17:12:24 -0800 (PST) Return-Path: Received: from escobar5-pc ([181.133.180.140])
by mx.google.com with ESMTPS id w2sm5267588yhh.7.2013.03.07.17.12.22
(version=TLSv1 cipher=RC4-SHA bits=128/128);
Thu, 07 Mar 2013 17:12:23 -0800 (PST) Message-ID: <51393af7.027cec0a.0f2d.ffffa713#mx.google.com> MIME-Version: 1.0
From: "app" To: "user"
<[email2]#[domain].com>, [email1]#gmail.com Date: Thu, 07 Mar
2013 17:12:23 -0800 (PST) Subject: Invitation: Test 9 Content-Type:
multipart/alternative;
boundary=--boundary_0_9e5fb21c-1a19-477c-a576-04176397fb67
X-Gm-Message-State:
ALoCoQmdferSoIzk/zUGmI9SEnioj6H76AOGmK/HVLGAaL29QjhGXVj8Z9VuAewe0N38zdOEVvTH
----boundary_0_9e5fb21c-1a19-477c-a576-04176397fb67 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64
TWVldGluZzogVGVzdCA5DQpPcmdhbml6ZXI6IGpzZXNjb2JhckBiaW9hbnl3aGVyZS5j
b20NClN0YXJ0IHRpbWU6IFRodXJzZGF5LCBBcHJpbCA0LCAyMDEzIDE6MDA6MDAgQU0N
CkVuZCB0aW1lOiBUaHVyc2RheSwgQXByaWwgNCwgMjAxMyAyOjAwOjAwIEFNDQoNCkF0
dGVuZGVlczogDQoJLWpzZXNjb2JhckBiaW9hbnl3aGVyZS5jb20NCgktanNlc2NvYmFy
NUBnbWFpbC5jb20NCg0KRGVzY3JpcHRpb246IHNkZmRzZmRzZnMNCkxvY2F0aW9uOiBC
aW9tZWV0aW5ncw0K
----boundary_0_9e5fb21c-1a19-477c-a576-04176397fb67 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: base64
PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBYSFRNTCAxLjAgU3RyaWN0
Ly9FTiIgImh0dHA6Ly93d3cudzMub3JnL1RSL3hodG1sMS9EVEQveGh0bWwxLXN0cmlj
dC5kdGQiPg0KPGh0bWwgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwi
Pg0KPGhlYWQ+DQo8bWV0YSBodHRwLWVxdWl2PSJDb250ZW50LVR5cGUiIGNvbnRlbnQ9
InRleHQvaHRtbDsgY2hhcnNldD11dGYtOCIgLz4NCjx0aXRsZT5JbnZpdGF0aW9uOiBU
ZXN0IDk8L3RpdGxlPg0KPC9oZWFkPg0KPGJvZHk+DQo8cD48c3Ryb25nPk1lZXRpbmc6
PC9zdHJvbmc+IFRlc3QgOTwvcD4NCjxwPjxzdHJvbmc+T3JnYW5pemVyOjwvc3Ryb25n
PiBqc2VzY29iYXJAYmlvYW55d2hlcmUuY29tPC9wPg0KPHA+PHN0cm9uZz5TdGFydCB0
aW1lOjwvc3Ryb25nPiBUaHVyc2RheSwgQXByaWwgNCwgMjAxMyAxOjAwOjAwIEFNPC9w
Pg0KPHA+PHN0cm9uZz5FbmQgdGltZTo8L3N0cm9uZz4gVGh1cnNkYXksIEFwcmlsIDQs
IDIwMTMgMjowMDowMCBBTTwvcD4NCjxici8+DQo8cD48c3Ryb25nPkF0dGVuZGVlczo8
L3N0cm9uZz4gPC9wPjx1bD4NCjxsaT5qc2VzY29iYXJAYmlvYW55d2hlcmUuY29tPC9s
aT4NCjxsaT5qc2VzY29iYXI1QGdtYWlsLmNvbTwvbGk+DQo8L3VsPjxici8+DQo8cD48
c3Ryb25nPkRlc2NyaXB0aW9uOjwvc3Ryb25nPiBzZGZkc2Zkc2ZzPC9wPg0KPHA+PHN0
cm9uZz5Mb2NhdGlvbjo8L3N0cm9uZz4gQmlvbWVldGluZ3M8L3A+DQo8L2JvZHk+DQo8
L2h0bWw+DQo=
----boundary_0_9e5fb21c-1a19-477c-a576-04176397fb67 Content-Type: text/calendar; method=REQUEST; charset=UTF-8
Content-Transfer-Encoding: 7bit
BEGIN:VCALENDAR PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0 CALSCALE:GREGORIAN METHOD:REQUEST BEGIN:VEVENT
DTSTART:20130404T010000Z DTEND:20130404T020000Z
DTSTAMP:20130308T011216Z ORGANIZER;mailto:[Email2]#[domain].com
UID:event_36#[domain].com
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;X-NUM-GUESTS=0:mailto:[email2]#[domain].com
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;X-NUM-GUESTS=0:mailto:[email1]#gmail.com
CREATED:20130308T011154Z DESCRIPTION:sdfdsfdsfs
LAST-MODIFIED:20130308T011154Z LOCATION:Somewhere SEQUENCE:0
STATUS:CONFIRMED SUMMARY:Test 9 TRANSP:OPAQUE END:VEVENT END:VCALENDAR
----boundary_0_9e5fb21c-1a19-477c-a576-04176397fb67--
Well, do you get any invitation to display correctly in this second account (e.g. an invitation from the first account or from MSFT Outlook) ?
The above message looks just fine but may want to try the following MIME structure.
content-type:multipart/mixed
content-type:multipart/alternative
essentially the 3 mime parts that you already have above
content-type:text/calendar
Content-Disposition: attachment; filename="invite.ics"
the ics invitation (again)
I changed METHOD:REQUEST for METHOD:PUBLISH in the ical text and now it shows me the event in both accounts, it doesn't get automatically added to google calendar but at least it's showing in gmail message

Resources