PHP shell_exec () - problems running the command

I am new to php shell commands, so please bear with me. I am trying to run shell_exec () on my server. I am trying to use the following php code:

$output = shell_exec('tesseract picture.tif text_file -l eng');
echo "done";

I have picture.tif in the same directory as the php file. In my shell, I can run this without a problem.

It takes some time to run the code, after which it does not make the text file like it is when I run it on the command line.

+3
source share
2 answers

For your comment:

Should I write a loop in the shell instead?

You can write a very simple shell script to run the command in a loop. First create a script file:

touch myscript.sh

Make the script executable:

chmod 700 myscript.sh

, vim, :

for ((  i = 0 ;  i <= 5;  i++  ))
do
  tesseract picture.tif text_file -l eng
done

Thats the very basics of it ( , ), . script, , , script:

./myscript.sh

:

/path/to/mydir/myscript.sh
+1

? , PHP , . ?

+1

Source: https://habr.com/ru/post/1792939/


All Articles