2

I am getting the error:

PHP Fatal error:  Class 'Symfony\\Component\\Process\\PhpProcess' not found in ...

It's my first time using Symfony. I download the files from the GitHub site. Since the downloaded files are of the Process directory, I created folders in order to have the correct path. (Symfony/Component/Process/DOWNLOADED FILES).

I placed the Symfony directory in the main directory (where my index file is).

Is this how you install Symfony? (Note I only need the Process sub-directory and not the whole framework)

For now I am using this ready-made code, just to see if I can get it running:

use Symfony\Component\Process\PhpProcess;

    $command = file_get_contents('/hello_world.php');

    if ( $command ) {
        $process = new PhpProcess($command); //<----- GETTING ERROR HERE 
        $process->run();

        if ($process->isSuccessful()) {

            $output = $process->getOutput();
            // ... 
        }
        else {
            throw new Exception($process->getErrorOutput());
        }
    }

Why am I getting this error and how can I fix it please? Is it due to a bad path?

luchaninov
  • 6,792
  • 6
  • 60
  • 75
Goaler444
  • 2,591
  • 6
  • 35
  • 53

1 Answers1

2

I think it has to do with namespace registration, have you checked that the namespace that defines the class is loaded?, check the ClassLoader reference

Check the autoload.php file inside your app directory

james_bond
  • 6,778
  • 3
  • 28
  • 34