davy_yg's avatar
Level 27

Laravel error on server

Hello,

My laravel files works on local and when I push it on the server, I get this error message:

[agribisc@jkt09 public_html]$ composer i Installing dependencies from lock file (including require-dev) Verifying lock file contents can be installed on current platform. Your lock file does not contain a compatible set of packages. Please run composer update.

Problem 1 - league/flysystem-local is locked to version 3.29.0 and an update of this package was not requested. - league/flysystem-local 3.29.0 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. Problem 2 - league/mime-type-detection is locked to version 1.16.0 and an update of this package was not requested. - league/mime-type-detection 1.16.0 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. Problem 3 - league/flysystem-local 3.29.0 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. - league/flysystem 3.29.1 requires league/flysystem-local ^3.0.0 -> satisfiable by league/flysystem-local[3.29.0]. - league/flysystem is locked to version 3.29.1 and an update of this package was not requested.

To enable extensions, verify that they are enabled in your .ini files: - /opt/alt/php81/etc/php.ini - /opt/alt/php81/link/conf/alt_php.ini You can also run php --ini in a terminal to see which files are used by PHP in CLI mode. Alternatively, you can run Composer with --ignore-platform-req=ext-fileinfo to temporarily ignore these requiredextensions.

Any clue why?

0 likes
2 replies
LaryAI's avatar
LaryAI
AI
Best Answer
Level 58

The error message you're encountering indicates that the ext-fileinfo PHP extension is not enabled on your server. This extension is required by some of the packages in your Laravel project. Here's how you can resolve this issue:

  1. Enable the fileinfo extension:

    You need to enable the fileinfo extension in your PHP configuration. Here are the steps to do that:

    • Locate your php.ini file. The error message provides paths where your php.ini files might be located:

      • /opt/alt/php81/etc/php.ini
      • /opt/alt/php81/link/conf/alt_php.ini
    • Open the php.ini file in a text editor.

    • Search for the line that mentions extension=fileinfo. If it's commented out (i.e., it starts with a semicolon ;), remove the semicolon to uncomment it. If the line doesn't exist, add it:

      extension=fileinfo
      
    • Save the changes and close the editor.

  2. Restart your web server:

    After making changes to the php.ini file, you need to restart your web server for the changes to take effect. The command to restart the server depends on the server software you're using. Here are some common commands:

    • For Apache:

      sudo systemctl restart apache2
      
    • For Nginx:

      sudo systemctl restart nginx
      
  3. Verify the extension is enabled:

    You can verify that the fileinfo extension is enabled by running the following command:

    php -m | grep fileinfo
    

    If the extension is enabled, you should see fileinfo in the output.

  4. Re-run Composer:

    After enabling the extension, try running the Composer install command again:

    composer install
    

By following these steps, you should be able to resolve the error and successfully install your Laravel project's dependencies on the server.

Please or to participate in this conversation.