T
T
TechNOIR2018-01-18 15:58:02
PHP
TechNOIR, 2018-01-18 15:58:02

PHP. Doesn't work with fgetcsv after transfer to hosting. How's the fight?

Good afternoon. Transferred this chat bot from me here One to one. Everything works for me (Vesta and PHP7 are installed) Where the transferred fgestcsv does not work (ISPManager+PHP7 FastCGI (Nginx + PHP-FPM) is installed). Must reply to Hi. But he says he doesn't understand. standard phrase. What could be the problem? Some extra. do you need a module? Processing script code:

$responses=array();

$row = 1;
$handle = fopen("../chat/base/base.csv", "r");
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
    $num = count($data);
  //  echo "<p> $num полей в строке $row: <br /></p>\n";
    $row++;

  $d=iconv('windows-1251','utf-8//IGNORE',$data[0]);
  $b=iconv('windows-1251','utf-8//IGNORE',$data[1]);

  $responses["$d"] = $b;


}
fclose($handle);




  $q = $_GET["q"];

  $response = "";

  if ($q != "") {
    # code...
    $q = strtolower($q);
    foreach ($responses as $r => $value) {
      # code...
      if (strpos($r, $q) !== false) {
        # code...
        $response = $value;
      }

    }
  }
  $noresponse = "Я не понимаю!";
  echo $response === "" ? $noresponse : $response;
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
synapse_people, 2018-01-18
@synapse_people

most likely you do not have enough rights to open the file
tryvar_dump($handle);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question