Update: by redirecting stderr from php exec, I can now see that running maxima produces a segmentation fault, increasing the likelihood that this is in fact a bug.
Important note: this used to work perfectly on older versions of PHP/Ubuntu.
I'm trying to get PHP exec() (or shell_exec() ) to redirect the output (stdout) of a maxima call to a text file. All I get is an empty file.
I have tried the simplest of commands:
exec( "maxima -b /var/www/tmpIn.txt > /var/www/tmp/tmpOut.txt");
(tmpIn.txt just contains the text "1+1;", all permissions are set properly).
If I paste this command in the terminal it will work fine, php's exec() will only produce an empty file. However, this is the case only for the maxima binary; cat/echo/ls etc. redirect just fine.
To me this seems exceedingly strange especially as this code used to work well as mentioned. Is there any workaround for this "bug"?
System info: ubuntu 20.04 PHP version 7.4 on Apache2 Maxima 5.43.2 bash