I have a shell script which works perfectly if I run it in the terminal (MAC OSX)
#!/bin/bash
cd /Applications/XAMPP/xamppfiles/htdocs/chemedit/
babel -imol 'a.mol' -oinchi 'outputfile.inchi'
babel -imol 'a.mol' -osmi 'a.smsi'
babel a.smi -O out.svg -xC -xe
exit
I have this in a file called a.sh
I want to run this from PHP using:
$output = shell_exec("bash a.sh 2>&1");
This does not work and returns:
Cannot write to outputfile.inchi
0 molecules converted
1 errors
for all files
I have given both files chmod 777.
I am pretty sure safe mode is off for PHP.
shell_execusing with your PHP configuration? Which shell and user are you using when you run it in your terminal? Do both configurations differ? If yes, in which points?