2

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 '"'
LOGH17
  • 33
  • 2
  • Maybe a permission problem ? Are you sure the user for your php server is loghgxli and/or has the permission to execute scripts at this location ? – Pac0 Nov 23 '17 at 13:38
  • yes i have contacted support and have the right permissions, and yes im sure about the user is loghgxli aswell @Pac0 – LOGH17 Nov 23 '17 at 13:42

2 Answers2

1

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

AZinkey
  • 5,209
  • 5
  • 28
  • 46
0

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()?)

Pac0
  • 21,465
  • 8
  • 65
  • 74