Missing fileinfo PHP extension on the Laravel application, 500 server issue.

  Uncategorized

Introduction

A missing PHP extension in a Laravel application can cause a 500 Internal Server Error. Enabling debug mode helps identify the exact issue, such as missing PHP modules like fileinfo.


Prerequisites

  • Access to the server or File Manager
  • Access to WHM
  • Laravel application installed on the server

Implementation

Enable Debug Logs on Laravel Application

Step 1

Log in to the server or browse the domain home directory through File Manager.


Step 2

Change the directory to the Laravel application directory.


Step 3

Locate the .env file.


Step 4

Set the following parameter to true:

APP_DEBUG=true


Step 5

Save the file and exit.

Now open the website URL in your browser. It should display the detailed error message. Based on the displayed error, proceed with the required fix.


Example: Missing fileinfo PHP Extension

If the error indicates that the fileinfo PHP module is missing, follow the below steps to enable it.


Enable the fileinfo Module from WHM

  1. Log in to WHM.
  2. In the search bar on the left side, search for:

EasyApache 4

  1. Open EasyApache 4 and check the Currently Installed Packages section.
  2. Click on the Customise button.
  3. Navigate to the PHP Extensions section.
  4. Search for the module name:

file info

  1. Enable the fileinfo extension for the required PHP version by turning it ON.
  2. Click Next and then click Provision to apply the changes.
  3. Wait for the provisioning process to complete successfully.

Final Step

After completing the troubleshooting and enabling the required extension, update the .env file again with:

APP_DEBUG=false

This disables debug mode for security purposes.


Conclusion

By enabling debug mode in Laravel and checking the detailed error logs, you can identify missing PHP extensions, such as fileinfo, and resolve 500 server issues efficiently through WHM.

LEAVE A COMMENT