Page 2 of 2

Re: PhpSpreadsheet run as a Procedure

Posted: Mon Apr 03, 2023 7:11 pm
by kev1n
I didn't test it myself but normally you can include the Composer-generated autoload file by adjusting the path to point to the parent directory or a different one that is not within the nuBuilder directory structure.

E.g.:

Code: Select all

require_once __DIR__ . '/../vendor/autoload.php';

Re: PhpSpreadsheet run as a Procedure

Posted: Mon Apr 03, 2023 9:18 pm
by treed
Hi Kevin, I didn't do a good job asking my question. The require once works. Here's my code, it just writes a Hello World spread sheet as a test.

Code: Select all

echo "start";
require_once '/home/wcbbq-cloud/vendor/autoload.php';

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

$savePath='/home/wcbbq-cloud/var/www/html/db/temp/';
$spreadsheet = new Spreadsheet();
$activeWorksheet = $spreadsheet->getActiveSheet();
$activeWorksheet->setCellValue('A1', 'Hello World !');

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

echo "success";
I'm getting to the save line and the the server log shows the following message.

Code: Select all

[Mon Apr 03 12:05:47.635903 2023] [proxy_fcgi:error] [pid 63086] [client 192.52.251.253:43396] AH01071: Got error 'PHP message: PHP Warning:  fopen(/home/wcbbq-cloud/var/www/html/db/temp/hello world.xlsx): Failed to open stream: No such file or directory in /home/wcbbq-cloud/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/BaseWriter.php on line 128', referer: https://dbs.winecountry-bbq.com/index.php
So it looks like it is unable to write the file. The $64 question is why doesn't it???

Re: PhpSpreadsheet run as a Procedure

Posted: Tue Apr 04, 2023 5:47 am
by kev1n
Does it work if you leave out the path ? Is the path correct?

It appears that your question may not be directly related to nuBuilder. I would recommend asking your question on platforms like Stack Overflow or GitHub, where you can find a more relevant audience with expertise in the topic you are inquiring about. These platforms can provide better assistance and help you find the answer you need more effectively.

Good luck, and I hope you find the information you're looking for!