PHPOffice / PhpSpreadsheet

A pure PHP library for reading and writing spreadsheet files
https://phpspreadsheet.readthedocs.io
MIT License
13.34k stars 3.46k forks source link

I woulde like try to use PhpSpreadsheet but is error . #2289

Closed than2557 closed 1 year ago

than2557 commented 3 years ago

PHP Fatal error: Uncaught Error: Class 'PhpOffice\PhpSpreadsheet\Calculation\Engine\CyclicReferenceStack' not found in /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php:2763\nStack trace:\n#0 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php(476): PhpOffice\PhpSpreadsheet\Calculation\Calculation->__construct()\n#1 /var/www/html/connect_ssh/phpexcel.php(7): PhpOffice\PhpSpreadsheet\Spreadsheet->__construct()\n#2 {main}\n thrown in /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php on line 2763, referer: http://***********/connect_ssh/

this my code : <?php require_once('../vendor/autoload.php');

use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

$spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); $sheet->setCellValue('A1', 'TEST!');

$writer = new Xlsx($spreadsheet); $writer->save('hello world.xlsx');

?>

oleibman commented 3 years ago

Unable to duplicate. Can you share all of your code?

than2557 commented 3 years ago

this is all code. unknown `<?php require_once('../vendor/autoload.php');

use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

$spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); $sheet->setCellValue('A1', 'Hello World !');

$writer = new Xlsx($spreadsheet); $writer->save('hello world.xlsx');

$connection = ssh2_connect('****');

if (ssh2_auth_password($connection,'root','****)) {

// echo "Authentication Successful!";

$stream = ssh2_exec($connection,'du -hc /opt/backup/'); stream_set_blocking($stream, true); $stream_out = ssh2_fetch_stream($stream,SSH2_STREAM_STDIO); $data_nas = array(); $data = stream_get_contents($stream_out);

foreach(preg_split("/((\r?\n)|(\r\n?))/", $data) as $line){

array_push($data_nas,$line);

} // echo $data;

$data_encodejson = array();

$key = 0; foreach($data_nas as $dtr){

array_push($data_encodejson,array('key'=>$key,'data'=>$dtr,'size'=>substr($dtr,0,4)));

$key++; $data_nasjson = json_encode($data_encodejson);

} $myfile = fopen("newfile.txt","w") or die("Unable to open file!");

fwrite($myfile,$data_nasjson);

fclose($myfile);

// $arr = str_split($data_nas); // echo $arr; // echo $data_nasjson;

} else { die('Authentication Failed...');

} ?>`

than2557 commented 3 years ago

Unable to duplicate. Can you share all of your code?

https://github.com/PHPOffice/PhpSpreadsheet/issues/2289#issuecomment-913962245

oleibman commented 3 years ago

I do not understand what you are trying to accomplish in the lines beginning with $connection = ssh2_connect. But, I again do not see a problem with the immediately preceding line $writer->save; the file is saved correctly, and that seems to be the last time you use PhpSpreadsheet in the program. Are you seeing a problem with the save, or later in your program?

than2557 commented 3 years ago

this is my frist time use phpSpredsheet I try to get data ssh size on server and push to array json save excel sheet This my discord. https://discord.gg/PZpmYpKw

ในวันที่ พฤ. 9 ก.ย. 2021 20:11 น. oleibman @.***> เขียนว่า:

I do not understand what you are trying to accomplish in the lines beginning with $connection = ssh2_connect. But, I again do not see a problem with the immediately preceding line $writer->save; the file is saved correctly, and that seems to be the last time you use PhpSpreadsheet in the program. Are you seeing a problem with the save, or later in your program?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PHPOffice/PhpSpreadsheet/issues/2289#issuecomment-916078186, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMB5IFOFZ5WPCUYWOQKW7RTUBCW7TANCNFSM5DP3RADQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

oleibman commented 1 year ago

No update in 18 months, closing.