Link to home
Start Free TrialLog in
Avatar of simonlai
simonlai

asked on

apache & PHP 'exec'??

Dear all:

i try using with php 'exec' to execute a linux command. but it given non-response (not output).

but once i run the command with ssh, not problems on the command.

beside that i have check audit.log, can't found any log related. And i was add permission under sudoers file.

apache  ALL=NOPASSWD:/usr/local/bin/tesseract   ALL


can any one guide how to troubleshoot? I was try with & without SELINUX.


thanks.
Avatar of Sudaraka Wijesinghe
Sudaraka Wijesinghe
Flag of Sri Lanka image

Is it just not providing out put or command not executing at all?

To get an out put in exec you need to initialize the second parameter as an array.

$output=array();
exec('/command/here', $output);

Open in new window

Avatar of simonlai
simonlai

ASKER

thanks for reply. sudaraka.

The command wiill generate a txt file in the direction. But it was not. Even i disabled SELINUX, still not able to run the command with apache.

I checked the direction, the permission was open.


thanks.
this my command

exec("tesseract /var/www/html/ipc/ocr/".$destination." /var/www/html/ipc/ocr/uploadfile/".$nameFile."");

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Sudaraka Wijesinghe
Sudaraka Wijesinghe
Flag of Sri Lanka image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks for your guide...... sudaraka
You are welcome, Thanks for the points.