Il codice PHP che segue in ambiente locale (con WampServer installato) funziona correttamente, su Altervista no, qualche consiglio?
Codice:
<!DOCTYPE html>
<html>
<head>
<title>Aggiunge 10 davanti i codici che non lo presentano già</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<?php
$file_path_into_array = glob("/myfolder/*.txt");
$file_path = $file_path_into_array[0];
$file = fopen($file_path, "r+");
$file_in_row = file($file_path);
$i = 0;
foreach ($file_in_row as $row_content){
if ($i > 0) {
$char = substr($row_content, 94, 11);
if(strlen(trim($char)) == 11){
$new_row_content[] = $row_content;
} else if(strlen(trim($char)) != 0){
$new_row_content[] = str_replace($char, "10$char" - 2, $row_content);
}
} else if($i == 0) {
$new_row_content[] = $row_content;
}
$i++;
}
fclose($file);
$string = implode("\n", $new_row_content);
$new_file = fopen($file_path, "w+");
fwrite($new_file, $string);
fclose($new_file);
echo "Ho creato un nuovo file: <b>$file_path<b>";
?>
</body>
</html>