TrueBlue TrueBlue - 1 year ago 67
Linux Question

From PHP a Simple Linux Script to return "Hello World"

Okay, happy to accept down votes to get to the bottom of my problem. I am brand new to Linux but have hosted my PHP based site on a Linux cloud server and need to run a FFMPEG script to convert a video. Under windows I have the full application working but under Linux I can't seem to get a basic script working and was wondering if someone can point me in the right direction. I have read the myriad posts on this, for example, Run bash Command from PHP but it does not help me get to the bottom of it.

Here is what I have so far.

$old_path = getcwd();
$new_path = getcwd();
echo('newpath '.$new_path); <-- this outputs 'old_path/videos'
$temp= shell_exec('./');
echo ($temp) <-- produces nothing

Test script is in the video directory and is simply

echo "hello world"


Answer Source

In shell script must write and the interpretator.

Try this: shell_exec('php ./');

Edit: change php with correct interpretator (bash, sh...)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download