viest / php-ext-xlswriter

🚀 PHP Extension for creating and reader XLSX files.
https://xlswriter.viest.me
BSD 2-Clause "Simplified" License
2.26k stars 234 forks source link

Uncaught Vtiful\Kernel\Exception: Configure 'path' directory does not exist in... #387

Closed henriqueccruz closed 3 years ago

henriqueccruz commented 3 years ago

Hi. I'm using cPanel and installed the xlswriter extension via PHP PECL Module installer. I was able to install and initialize the module without issues, until I tried to use the extension.

I used the following code

`<?php

$config = ['path' => './tests']; $excel = new \Vtiful\Kernel\Excel($config);

// Build the sample file $filePath = $excel ->fileName('tutorial.xlsx', 'test1') ->header(['sheet']) ->data([['test1']]) ->addSheet('test2') ->header(['sheet']) ->data([['test2']]) ->output();`

Script prints out:

Fatal error: Uncaught Vtiful\Kernel\Exception: Configure 'path' directory does not exist in {%my_script_path_here%}/index.php:8 Stack trace: #0 {%my_script_path_here%}/index.php(8): Vtiful\Kernel\Excel->fileName('tutorial.xlsx', 'test1') #1 {main} thrown in {%my_script_path_here%}/index.php on line 8

Tried to upload the tests folder along with the script, with no results. Any directions?

henriqueccruz commented 3 years ago

Solved by changing $config = ['path' => './tests']; to $config = ['path' => __DIR__];