I have a php web page being ran by the apache server, it is stored in /var/www/myweb/ and called index.php
Now I am trying to call a script in /home/me/ called test.sh from the php webpage . All it does is create a file1 on /home/me/
test.sh:
#!/bin/bash
touch file1
~
~
~
~
inside index.php, I am trying to call the script
index.php:
if ($_GET['run'])
{
exec('/home/me/test.sh');
}
unfortunately this is not working, and it seems the reason is permission problems. I went ahead and try to run this command from /var/www/myweb/
/home/me/test.sh
and I got this error:
touch: cannot touch ‘file1’: Permission denied
Is there a way to fix this problem ?
cdorchdir()in your scripts? What doesls -ld /var/www/myweb /home/mereturn? Your code probably does not execute where you think it does.drwxr-xr-x 29 me me 4096 Mar 27 21:02 /home/me/ drwxr-xr-x 4 root www-data 4096 Mar 27 20:22 /var/www/html/