shell_exec gives no output when hosted on namecheap

Viewed 157

So I have a index.php file with a shell_exec command, and it works fine when I run it in terminal on ubuntu, but when uploaded to namecheap hosting it doesn't work.

http://www.logh.info/ here is the website, and yes im 100% sure the path to the .sh file is right

<html>
<head>
<style>
div {
font family: Ubuntu;
background-color: #F2F2F2;
}
</style>
</head>
<body>
<div>
<h1> <center> Instagram Full Size Profile Picture </center> </h1>
</div>
<center>
<?php 
if(isset($_REQUEST['input'])) {
$name = $_REQUEST['input'];
$output = shell_exec("/home/loghgxli/public_html/instapic.sh $name");
?>
<form action="" method="get">
Enter Instagram Username: <input type="text" name="input">
<input type="submit" value="View">
</form>
<?php
if(isset($output)) {
echo "<img src=$output>";
}
?>
</center>
</body>

#!/bin/bash
NAME=$1
#curl -s https://instagram.com/$NAME/ | grep image | grep fbma | sed 's,s150x150/,,g' | cut -f 4 -d '"'
curl -s https://instagram.com/$NAME/ | grep "og:image" | sed 's,s150x150/,,g' | cut -f 4 -d '"'
2 Answers

you can check if they (your hosting provider) allowed you to execute shall_exec() by ini_get('disable_functions')

You should pass arguments to your script this way :

shell_exec("/home/loghgxli/public_html/instapic.sh '".$name."'");

(More info here : Passing Variables to shell_exec()?)

Related