PHP use keyword is causing 500 server error

user7926703

I'm trying to implement PhpPresentation to convert some files, so I have the following code:

use PhpOffice\PhpPresentation\src\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\src\PhpPresentation\IOFactory;
use PhpOffice\PhpPresentation\src\PhpPresentation\Style\Color;
use PhpOffice\PhpPresentation\src\PhpPresentation\Style\Alignment;

For some reason exactly this piece of code is causing 500 Internal server error. I have error reporting set to all, but no errors are shown. The path is right, i have the PhpOffice folder in my root directory(public_html) and the corresponding subfolders too.

autoloader code is loaded this way:

require_once 'PhpOffice/PhpPresentation/src/PhpPresentation/Autoloader.php';
  \PhpOffice\PhpPresentation\Autoloader::register();
  require_once 'PhpOffice/src/Common/Autoloader.php';
  \PhpOffice\Common\Autoloader::register();
user7926703

Issue fixed, thanks to this https://stackoverflow.com/a/33355711/7926703

I was using 'use' inside a function which is wrong and error-causing.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related