I want to execute following command on my Ubuntu server using php:
android create project --target 8 --name $fname --path ./$fname --activity MainActivity --package $fpack 2>&1
The above command is to create an Android app project. So when I enter this command on my terminal then it works fine, but when I execute it via PHP:
<?php
$fname = $_POST['fname'];
$fpack = $_POST['fpack'];
$email = $_POST['email'];
// Creating a new Android project.
var_dump(shell_exec("android create project --target 8 --name $fname --path ./$fname --activity MainActivity --package $fpack 2>&1"));
?>
When I run my PHP script I get the following output:
string(26) "sh: 1: android: not found "
Why it works when I enter manually in terminal (from user 'ashish' account) but not with php? my apache user and group is same (ashish). Any help will be appreciated :)
putenv
to set environment variables and report back