I have the following error showing up in my laravel.log file on a website I have running. How can I pin down where the error originates from? As the stack trace is so short I am unsure where to start.
[2017-07-03 16:05:13] production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined function Illuminate\Filesystem\finfo_file()' in /home/uksacbor/laravel-projects/attestation/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:254 Stack trace: #0 {main}
I've ran a search on the site's folder using sublime's global search for when finfo_file()
is used and I've used it in a helper in a test...
private function prepareFileUpload($path, $name)
{
TestCase::assertFileExists($path);
$pathInfo = pathinfo($path);
$copyPath = $pathInfo['dirname'] . $pathInfo['filename'] . '_copy' . $pathInfo['extension'];
\File::copy($path, $copyPath);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $copyPath);
return new \Illuminate\Http\UploadedFile($copyPath, $name, $mime, filesize($copyPath), null, true);
}
Currently, my tests are all passing.
Any ideas?
You should install fileinfo
using WHM
or DirectAdmin
When you are managing the server yourself you should run
sudo pecl install fileinfo
from the commandline and edit php.ini (probably located at /etc/php.ini)
to contain the line
extension=fileinfo.so
don't forget to restart the web server. Depending on your os and web stack this is something like
When using a shared hosting, you probably have an option in the webinterface to enable it from there. For example in directadmin
Advanced features > Select PHP version
And then
Tick the checkbox next to fileinfo
Don't forget to click save
You are supposed to activate finfo_file()
[check this link]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With