<?php
$file = fopen("ваыыв.txt", "r") or die("не удалось создать файл");
$newfile = fopen("авыаыв.txt", 'w') or die("не удалось создать файл");
while (!feof($file)) {
$cat = fgets($file, 4096);
$cat = explode("\t", $cat);
$cat[0] = "'" . $cat[0] . "'=>";
$cat[1] = "'" . $cat[1] . "',";
$str = "". $cat[0] . $cat[1] . "\n";
fputs($newfile, $str);
}
$file = "/opt/php71/bin/php /var/www/www-root/data/www/site.com/send.php";
//$i = 1;
while(true){
if ($fh = fopen($file, 'r+')) {
echo "File opened successful\n";
if (flock($fh, LOCK_EX)) {
echo "Successfully locked filed with exclusive lock\n";
exec("/opt/php71/bin/php /var/www/www-root/data/www/site.com/send.php");
flock($fh, LOCK_UN);
} else {
fclose($fh);
continue;
}
fclose($fh);
break;
}
}