Skip to content

PHP Fatal error Call to undefined method fromShellCommandline #162

Description

@filipecsweb

Hi.

Error:

PHP Fatal error:  Uncaught Error: Call to undefined method Symfony\Component\Process\Process::fromShellCommandline() in /var/www/html/vendor/spatie/image-optimizer/src/OptimizerChain.php:97

I'm getting the error above when using the following code:

$optimizer = (new OptimizerChain())
    ->addOptimizer(
        new Jpegoptim([
            '-m80'
            '--strip-all',
            '--all-progressive',
            '--quiet',
        ])
    );

$optimizer
    ->optimize('image.jpg');

I'm running spatie/image-optimizer 1.6.

Also, oddly I could fix it changing the code to:

$optimizer = (new OptimizerChain())
    ->addOptimizer(
        new Jpegoptim([
            '-m80'
            '--strip-all',
            '--all-progressive',
            '--quiet',
        ])
    );

// Composer autoload should be loading this file but it seems it's not...
require_once __DIR__ . '/vendor/symfony/process/Process.php';

$optimizer
    ->optimize('image.jpg');

Dou you know why?
Could someone please help?

Activity

  1. locked and limited conversation to collaborators on Feb 27, 2022
  2. converted this issue into a discussion #163 on Feb 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions