Page 1 of 2
Warning: date():
Posted: Mon Jul 13, 2015 9:28 pm
by Rulevoj
Во время использования
лезет ошибка
Code: Select all
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/admin/web/********.ru/public_html/cron/cron.php on line 3
Дата прописывается, что нужно сделать чтобы не ругался на часовой пояс?
Re: Warning: date():
Posted: Mon Jul 13, 2015 9:30 pm
by imperio
Прописать часовой пояс в php.ini и рестартануть апач
Re: Warning: date():
Posted: Mon Jul 13, 2015 10:20 pm
by Rulevoj
imperio wrote:Прописать часовой пояс в php.ini и рестартануть апач
Прописал
перезагрузил сервер.
в phpinfo

далее
опять ошибка
Code: Select all
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
и тд...
И еще ошибка
Code: Select all
Fatal error: Call-time pass-by-reference has been removed in /home/admin/web/*******.ru/public_html/cron/Net_Ping.php on line 92
Файл класса
Code: Select all
<?php
class Net_Ping
{
var $icmp_socket;
var $request;
var $request_len;
var $reply;
var $errstr;
var $time;
var $timer_start_time;
function Net_Ping()
{
$this->icmp_socket = socket_create(AF_INET, SOCK_RAW, 1);
socket_set_block($this->icmp_socket);
}
function ip_checksum($data)
{
for($i=0;$i<strlen($data);$i += 2)
{
if($data[$i+1]) $bits = unpack('n*',$data[$i].$data[$i+1]);
else $bits = unpack('C*',$data[$i]);
$sum += $bits[1];
}
while ($sum>>16) $sum = ($sum & 0xffff) + ($sum >> 16);
$checksum = pack('n1',~$sum);
return $checksum;
}
function start_time()
{
$this->timer_start_time = microtime();
}
function get_time($acc=2)
{
// format start time
$start_time = explode (" ", $this->timer_start_time);
$start_time = $start_time[1] + $start_time[0];
// get and format end time
$end_time = explode (" ", microtime());
$end_time = $end_time[1] + $end_time[0];
return number_format ($end_time - $start_time, $acc);
}
function Build_Packet()
{
$data = "abcdefghijklmnopqrstuvwabcdefghi"; // the actual test data
$type = "\x08"; // 8 echo message; 0 echo reply message
$code = "\x00"; // always 0 for this program
$chksm = "\x00\x00"; // generate checksum for icmp request
$id = "\x00\x00"; // we will have to work with this later
$sqn = "\x00\x00"; // we will have to work with this later
// now we need to change the checksum to the real checksum
$chksm = $this->ip_checksum($type.$code.$chksm.$id.$sqn.$data);
// now lets build the actual icmp packet
$this->request = $type.$code.$chksm.$id.$sqn.$data;
$this->request_len = strlen($this->request);
}
function Ping($dst_addr,$timeout=5,$percision=3)
{
// lets catch dumb people
if ((int)$timeout <= 0) $timeout=5;
if ((int)$percision <= 0) $percision=3;
// set the timeout
socket_set_option($this->icmp_socket,
SOL_SOCKET, // socket level
SO_RCVTIMEO, // timeout option
array(
"sec"=>$timeout, // Timeout in seconds
"usec"=>0 // I assume timeout in microseconds
)
);
if ($dst_addr)
{
if (@socket_connect($this->icmp_socket, $dst_addr, NULL))
{
} else {
$this->errstr = "Cannot connect to $dst_addr";
return FALSE;
}
$this->Build_Packet();
$this->start_time();
socket_write($this->icmp_socket, $this->request, $this->request_len);
if (@socket_recv($this->icmp_socket, &$this->reply, 256, 0))
{
$this->time = $this->get_time($percision);
return $this->time;
} else {
$this->errstr = "Timed out";
return FALSE;
}
} else {
$this->errstr = "Destination address not specified";
return FALSE;
}
}
}
?>
92 строчка выглядит так
Code: Select all
if (@socket_recv($this->icmp_socket, &$this->reply, 256, 0))
нужно что-то ещё установить и прописать php.ini?
Re: Warning: date():
Posted: Mon Jul 13, 2015 10:23 pm
by imperio
Скиньте вывод команды
укажите ОС на вашем сервере
Re: Warning: date():
Posted: Mon Jul 13, 2015 10:31 pm
by Rulevoj
imperio wrote:Скиньте вывод команды
укажите ОС на вашем сервере
fwrite($fd, "Время очистки - ".date("d.m.Y H:i")."\r\n");
Команда на php запускается через cron.
В файле дата прописывается. Ошибка приходит на почту, как отключить уведомления на почту я знаю, просто интересно как убрать ошибку!
ОС (CentOS 6.5)
Code: Select all
SERVER_SOFTWARE Apache/2.2.15 (CentOS)
System Linux ***********.ru 2.6.32-504.23.4.el6.x86_64 #1 SMP Tue Jun 9 20:57:37 UTC 2015 x86_64
Build Date Jun 10 2015 14:19:22
Re: Warning: date():
Posted: Mon Jul 13, 2015 10:32 pm
by imperio
Re: Warning: date():
Posted: Mon Jul 13, 2015 10:40 pm
by Rulevoj
imperio wrote:Скиньте вывод команды
Время не верное.... ))) должно быть 1:40
Re: Warning: date():
Posted: Mon Jul 13, 2015 10:43 pm
by imperio
Попробуйте выполнить
Code: Select all
ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime
и проверьте
Re: Warning: date():
Posted: Mon Jul 13, 2015 10:50 pm
by Rulevoj
imperio wrote:
Code: Select all
ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime
Выполнил, перезагрузил, ничего не изменилось....
Re: Warning: date():
Posted: Mon Jul 13, 2015 10:54 pm
by imperio
Будем разбираться.
Скиньте содержимое файла
/etc/php.ini
вывод date
Странно, но должно уже работать.
В настройках вашего скрипта есть настройка параметров часового пояса?
Шаблоны для апач и nginx - оба default в настройках веб-домена ?