I have created shell script:
#!/bin/bash
file="/home/upload/ftp/$1.ifc"
if [ -f "$file" ]
then
echo "Found."
else
echo "Not found."
fi
IfcConvert --use-element-guids /home/upload/ftp/${1}.ifc /home/upload/ftp/${1}.dae
When I go to linux terminal and execute it from there with
./script.sh drevodomek
everything works fine.. I got "Found." message and also converter executes
But when I created helper.php
<?php
if (file_exists("/home/upload/ftp/drevodomek.ifc"))
{
echo "The file exists";
}
else
{
echo "The file does not exists";
}
$cmd = "./script.sh drevodomek";
$results = shell_exec($cmd);
echo $results
?>
I get answers:
"The file exists." from PHP,
"Found." from script.sh
IfcConvert: input file "/home/upload/ftp/drevodomek.ifc" doesn't exists. from script.sh
I am new to linux, has anyone any idea what is the difference running script from terminal and with shell_exec()? Thanks!