Shell script fails when executed via php

Yashwant Shettigar

New Member
Mar 25, 2019
Reaction score
Hi Everyone,

I have written a script using shell and uemcli(Unity/EMC), which executes fine from backend. But, when I execute the same script using php i.e frontend, it fails.

Below is the code:

shell script code-

uemcli -d -u test -p test@123 /env/sp show
uemcli -d -u test -p test@123 /env/disk show

These are the commands that works fine in black screen. But it doesn't execute when called using php. There is no error being shown in apache error logs or in /var/log/messages.

Below is the code of php file


{ shell_exec("/bin/sh /test/"); }

That doesn't look like a php file.

I've done minimal php and no longer have the php command line installed. But judging from this reference, this might be closer to what you want:

shell_exec("/bin/sh /test/");
G'day @Yashwant Shettigar and welcome to :)

Thanks, too, Ken, for that input.

I am moving this Thread to Command Line, which is where scripting enquiries are also most frequently asked and answered.

Good luck, and enjoy your Linux

Chris Turner

Members online