I'm trying to run an ampl .run (or any ampl code) file from Laravel using Symfony Process. My code is as below:
$commandArray = array('./ampl');
$process = new Process($commandArray);
$process->setWorkingDirectory('/usr/local/bin/amplitude/amplide.linux64');
$process->run();
if (!$process->isSuccessful())
{
throw new ProcessFailedException($process);
}
dd($process->getOutput());
But I cannot start ampl. I get an error like:
""" The command "'./ampl'" failed.\n \n Exit Code: 2(Misuse of shell builtins)\n \n Working directory: /usr/local/bin/amplitude/amplide.linux64\n \n Output:\n ================\n \n \n Error Output:\n ================\n """
I suspected this was a permissions error in the directory but when I use:
$commandArray = array('ls');
it works and outputs the list of files and folders. I understand that ampl is basically a terminal program, so how do I access and write commands to it?
If someone can explain how to access terminal programs from Process, I think it would be very helpful. Thank you in advance.