Why am I not able to execute this bash script using php? I have tried
exec() as well as
<?php $old = getcwd(); echo $old; chdir($old); $message=exec("a.sh"); print_r($message); ?>
#!bin/bash echo "i am a" > /opt/lampp/htdocs/a.txt echo "Done"
I have tried
chdir as suggested here, as well as I have checked my
php.ini, it doesn't have anything. I have also checked other questions, but none seem to solve my problem.
chdir($old)twice? Is that a typo?
$oldshows the correct path of a.sh. As
a.share in the same dir.
chdirwas there because I copied that from somewhere, then edited the 1st chdir but not the second.
#!/bin/bashas the first line? Have you tried
binso it reads